Your solution should work for the requirement but if you want to always use the sorting from newest to oldest
Or, you can change the ascSort argument in the GetAllPosts method in the forum service from true to false and apply the reversed sorting mechanism throughout your application:
This is the default implementation.
public virtual IPagedList<ForumPost> GetAllPosts(int forumTopicId = 0,
int customerId = 0, string keywords = "",
int pageIndex = 0, int pageSize = int.MaxValue)
{
return GetAllPosts(forumTopicId, customerId, keywords, true,
pageIndex, pageSize);
}
You can reverse the sorting by changing the method to
public virtual IPagedList<ForumPost> GetAllPosts(int forumTopicId = 0,
int customerId = 0, string keywords = "",
int pageIndex = 0, int pageSize = int.MaxValue)
{
return GetAllPosts(forumTopicId, customerId, keywords, false,
pageIndex, pageSize);
}