【问题标题】:asp.net mvcscaffolding Postscontroller.cs sort to order by decendingasp.net mvc 脚手架 Postscontroller.cs 按降序排序
【发布时间】:2012-03-29 10:00:11
【问题描述】:
    //
    // GET: /Posts/

    public ViewResult Index()
    {
        return View(postRepository.AllIncluding(post => post.Comments));
    }

我想修改上面的代码以按 PublishDate 列以相反的顺序显示。

【问题讨论】:

    标签: asp.net asp.net-mvc-scaffolding


    【解决方案1】:

    可以在此处找到示例:

    1. MSDN LINQ Samples
    2. 您的问题似乎与 OrderByDescending 上的 answered question 类似

    【讨论】:

    • 谢谢..我找到了一个适合我的解决方案 var sort = from x in db.Posts select x;排序 = sort.OrderByDescending(x => x.PublishDate);返回视图(sort.ToList());
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-23
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 2022-01-05
    • 1970-01-01
    相关资源
    最近更新 更多