public async Task <IEnumerable <CommentDto> > Handle(GetPostCommentsQuery request, CancellationToken cancellationToken) { var commentsDtos = await _unitOfWork.Comments .Include(c => c.Person) .Where(c => c.PostId == request.PostId) .OrderByDescending(c => c.CreatedAt) .Select(c => _mapper.Map <CommentDto>(c)) .ToListAsync(); return(commentsDtos); }
public async Task <ActionResult <IEnumerable <GetPostCommentOutputModel> > > GetPostComments( [FromRoute] GetPostCommentsQuery query) => await this.Send(query);
public async Task <List <Comment> > HandleAsync(GetPostCommentsQuery query) { return(await _db.Comments.AsQueryable() .Where(c => c.PostId == query.PostId).ToListAsync()); }