public async Task <IEnumerable <CommentViewModel> > GetCommentsAsync(CommentSearchParams searchParams) { User user = await _userManager.FindByIdAsync(searchParams.UserId); Guard.Against.NullItem(user.Id, nameof(user)); var specification = new CommentFilterSpecification(searchParams); return(await _commentRepository.ListAsync <CommentViewModel>(specification, CommentHelpers.GetCommentMapperConfiguration())); }
public async Task <CommentViewModel> GetCommentByIdAsync(string commentId) { var comment = await _commentRepository.GetByConditionAsync <CommentViewModel>(x => x.Id == commentId, CommentHelpers.GetCommentMapperConfiguration()); Guard.Against.NullItem(comment, nameof(comment)); return(comment); }