dun*_*ika 2 c# asp.net-mvc list
我的控制器中有一个方法
public ActionResult Index()
{
return View(db.Posts.ToList());
}
Run Code Online (Sandbox Code Playgroud)
如何按降序排列列表?喜欢而不是从id:1开始,它从表中的最后一个id开始
public ActionResult Index()
{
return View(db.Posts.OrderByDescending(p => p.Id).ToList());
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3456 次 |
| 最近记录: |