public GetTopComments ( int postId, int commentsCount ) : List |
||
postId | int | |
commentsCount | int | |
return | List |
public List<Comment> GetTopComments(int postId, int commentsCount)
{
var comments = new List<Comment>();
try
{
var db = _commentRepository.GetTop(a => a.PostId == postId, commentsCount).ToList();
db.ForEach(a => comments.Add(CommentMapper.ToDto(a)));
}
catch (Exception ex)
{
throw new BlogException(ex.Message, ex.InnerException);
}
return comments;
}