public IEnumerable <IdeationReply> GetIdeationReplies(int id, int skip, int take, string orderBy = "recent") { List <IdeationReply> replies = _ideationRepository.ReadIdeationReplies(id).ToList(); switch (orderBy.ToLower()) { case "recent": replies.Sort((a, b) => DateTime.Compare(b.Created, a.Created)); break; case "top": replies.Sort((a, b) => b.Upvotes.CompareTo(a.Upvotes)); break; case "trending": replies = _trendingAlgorithm.GetTrendingList(replies).Result.ToList(); break; case "controversial": replies.Sort((a, b) => b.Downvotes.CompareTo(a.Downvotes)); break; } return(replies.Skip(skip).Take(take)); }