public async Task Consume(ConsumeContext <ArticleByIdRequestDto> context) { try { var result = await _operationArticles.GetByIdArticleAsync(context.Message.ArticleGuid); var article = _mapper.Map <ArticleDto>(result); await context.RespondAsync(new ArticleResponseDto { ArticleDto = article }); } 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> GetArticleById(Guid articleGuid) { try { var result = await _operationArticles.GetByIdArticleAsync(articleGuid); return(Ok(result)); } catch (NoArticlesFoundForAuthorAppException exception) { return(Ok(exception)); } }