public async Task Consume(ConsumeContext <ArticlesByIdAuthorRequestDto> context) { try { var listArticles = await _operationArticles.GetArticlesByAuthor(context.Message.AuthorGuid); var articles = _mapper.Map <IEnumerable <ArticleDto> >(listArticles); await context.RespondAsync(new ArticlesByIdAuthorResponseDto() { ArticlesDto = articles }); } catch (NoArticlesFoundForAuthorAppException e) { await context.RespondAsync(new NoArticlesFound { CodeException = e.CodeException, MassageException = $"{e.Message}" }); } catch (Exception e) { await context.RespondAsync(new NoArticlesFound { MassageException = $"{e.Message}" }); } }
public async Task <IActionResult> GetArticlesByIdAuthor(Guid authorGuid) { try { var result = await _operationArticles.GetArticlesByAuthor(authorGuid); return(Ok(result)); } catch (NoArticlesFoundForAuthorAppException exception) { return(Ok(exception)); } }