public async Task Consume(ConsumeContext <AuthorRequestDto> context) { try { var result = await _operationAuthors.GetByIdAuthorAsync(context.Message.AuthorGuid); var author = _mapper.Map <AuthorDto>(result); await context.RespondAsync(new AuthorResponseDto { AuthorDto = author }); } catch (NoAuthorFoundException e) { await context.RespondAsync(new NoAuthorFound { CodeException = e.CodeException, MassageException = $"{e.Message}" }); } catch (Exception e) { await context.RespondAsync(new NoAuthorFound { MassageException = $"{e.Message}" }); } }
public async Task <IActionResult> GetAuthorById(Guid authorGuid) { try { var result = await _operationAuthors.GetByIdAuthorAsync(authorGuid); return(Ok(result)); } catch (NoAuthorFoundException exception) { return(Ok(exception)); } }