public IHttpActionResult GetComment(long commentId) { CommentDto commentDto = CommentDto.CreateCommentDto(commentRepository.GetComment(commentId)); commentDto.TotalLikeCount = voteRepository.GetTotalLikesCounts(commentId); commentDto.TotalDislikeCount = voteRepository.GetTotalDislikesCounts(commentId); return(Ok(commentDto)); }
public IHttpActionResult GetComments(long postId) { return(Ok(commentRepository.GetComments(postId).Select(c => { CommentDto commentDto = CommentDto.CreateCommentDto(c); commentDto.TotalLikeCount = voteRepository.GetTotalLikesCounts(commentDto.CommentId); commentDto.TotalDislikeCount = voteRepository.GetTotalDislikesCounts(commentDto.CommentId); return commentDto; }).ToList())); }