public async Task Consume(ConsumeContext <ArticlesRequestDto> context) { try { var result = await _operationArticles.GetAllArticlesAsync(); var articles = _mapper.Map <IEnumerable <ArticleDto> >(result); await context.RespondAsync(new ArticlesResponseDto { 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> GetArticles() { try { var result = await _operationArticles.GetAllArticlesAsync(); return(Ok(result)); } catch (NoArticlesFoundForAuthorAppException exception) { return(Ok(exception)); } }