Beispiel #1
0
        //sort by date descending
        public List <Post> GetPostsByDateDescending()
        {
            var sortedPosts = posts.ToArray();

            SortByDate.Quicksort(sortedPosts, 0, (sortedPosts.Length - 1));
            return(sortedPosts.Reverse().ToList <Post>());
        }
Beispiel #2
0
        //sort by date ascending
        public List <Post> GetPostsByDateAscending()
        {
            //List<Post> sortedPosts = posts.OrderBy(o => o.Date).ToList();
            var sortedPosts = posts.ToArray();

            SortByDate.Quicksort(sortedPosts, 0, (sortedPosts.Length - 1));
            return(sortedPosts.ToList <Post>());
        }