public async Task <CQRSResult <AuthorGetDTO> > Handle(AuthorQuery request, CancellationToken cancellationToken) { var author = uow.AuthorsRepository.GetById(request.Id); if (author != null) { return(AuthorGetMap.ToDTO(author)); } else { return((null as AuthorGetDTO).AsCQRSResult(code: 404)); }; }
public async Task <CQRSResult <AuthorGetDTO> > Handle(AuthorQuery request, CancellationToken cancellationToken) { var author = uow.AuthorsRepository.GetById(request.Id); if (author != null) { return(mapper.Map <AuthorGetDTO>(author)); } else { return((new AuthorGetDTO { Id = request.Id }) .AsResult(code: 404)); } }