public IActionResult GetReplies(int ideationId, int skip, int take, [FromQuery(Name = "sortBy")] string sortBy = "recent") { List <IdeationReply> replies; int replyAmount; if (sortBy == "reported") { replies = _ideationManager.GetReportedIdeationReplies(ideationId, skip, take).ToList(); replyAmount = _ideationManager.GetReportedIdeationReplyCountByIdeation(ideationId); } else { replies = _ideationManager.GetIdeationReplies(ideationId, skip, take, sortBy).ToList(); replyAmount = _ideationManager.GetIdeationReplyCountByIdeation(ideationId); } if (!replies.Any()) { return(Ok()); } var replyDtos = new List <IdeationReplyDTO>(); replies.ForEach(r => { var replyDto = new IdeationReplyDTO() { IdeationReplyId = r.IdeationReplyId, IdeationId = r.Ideation.IdeationId, UpVotes = r.Upvotes, NumberOfComments = _ideationManager.CommentAmount(r.IdeationReplyId), CreatedString = r.Created.FormatParasableDate(), Title = r.Title, UserDisplayName = r.User.GetDisplayName() }; if (sortBy == "reported") { replyDto.UserDisplayName = r.User.GetFullName(); replyDto.ReportCount = r.Reports.Count; } replyDtos.Add(replyDto); }); return(Ok(new { count = replyAmount, replies = replyDtos })); }