标签:
public ActionResult Index() { using (ApplicationDbContext db = new ApplicationDbContext()) { //var log = db.Log.ToList(); //return View(log); /* order by date asc var log = from p in db.Log orderby p.Date select p; return View(log.ToList()); * */ /* order by date desc var log = from p in db.Log orderby p.Date descending select p; return View(log.ToList()); * */ /* order by date asc var log = db.Log.OrderBy(p => p.Date).ToList(); return View(log); * */ /* order by date desc var log = db.Log.OrderByDescending(p => p.Date).ToList(); return View(log); * */ /* order by date desc,id asc var log = from p in db.Log orderby p.Date descending, p.ID select p; return View(log.ToList()); * */ //order by date desc,id asc var log = db.Log.OrderByDescending(p => p.Date).ThenBy(p => p.ID).ToList(); return View(log); } }
标签:
原文地址:http://www.cnblogs.com/milo-xie/p/4803667.html