Blog.Logic.Core.CommentsLogic.GetTopComments C# (CSharp) 메소드

GetTopComments() 공개 메소드

public GetTopComments ( int postId, int commentsCount ) : List
postId int
commentsCount int
리턴 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;
        }