Sort by date modified

Topics: Business Logic Layer
Apr 24, 2015 at 10:21 AM
How can we sort the posts based on the Date modified instead of date created ?
Apr 24, 2015 at 6:50 PM
One way might be to add sorting to the Post List control.

Custom/Controls/PostList.ascx.cs
 private void BindPosts()
        {
            if (this.Posts == null) {
                // no posts provided, load all posts by default
                Posts = Post.ApplicablePosts.ConvertAll(new Converter<Post, IPublishable>(delegate(Post p) { return p as IPublishable; }));
            }

            // Line added for sorting
            Posts.Sort(delegate(IPublishable ip1, IPublishable ip2) { return ip2.DateModified.CompareTo(ip1.DateModified); });