public async Task <Pagination <ToDoCommentResponse> > Handle(GetToDoCommentListQuery request, CancellationToken cancellationToken) { var spec = new ToDoCommentSpec(request); var countSpec = new ToDoCommentWithFiltersForCountSpec(request); var totalItems = await _toDoCommentRepository.CountAsync(countSpec); var todo = await _toDoCommentRepository.ListWithSpecAsync(spec); var data = _mapper.Map <IReadOnlyList <Domain.Entities.ToDoComment>, IReadOnlyList <ToDoCommentResponse> >(todo); return(new Pagination <ToDoCommentResponse>(request.PageIndex, request.PageSize, totalItems, data)); }
public async Task <ToDoCommentResponse> Handle(GetToDoCommentbyIdWithQuery request, CancellationToken cancellationToken) { var spec = new ToDoCommentSpec(request.Id); var data = await _toDoRepository.GetEntityWithSpec(spec); if (data == null) { throw new NotFoundException(nameof(Domain.Entities.ToDoComment), request.Id); } _logger.LogInformation($"Succesfully Gets ToDo: {request.Id}"); return(_mapper.Map <ToDoCommentResponse>(data)); }