コード例 #1
0
        public async Task Consume(ConsumeContext <ArticleGoArchiveRequestDto> context)
        {
            try
            {
                var result = await _operationArticles.GoArchive(context.Message.ArticleGuid);

                if (result)
                {
                    await context.RespondAsync(new ArticleGoArchiveResponseDto());
                }
                else
                {
                    throw new FailedTransferToArchiveAppException();
                }
            }
            catch (FailedTransferToArchiveAppException e)
            {
                await context.RespondAsync(new FailedTransferToArchive
                {
                    CodeException    = e.CodeException,
                    MassageException = $"{e.Message}"
                });
            }
            catch (Exception e)
            {
                await context.RespondAsync(new FailedTransferToArchive
                {
                    MassageException = $"{e.Message}"
                });
            }
        }
コード例 #2
0
        public async Task <IActionResult> GoArchiveArticle(Guid articleGuid)
        {
            try
            {
                var result = await _operationArticles.GoArchive(articleGuid);

                return(Ok(result));
            }
            catch (FailedTransferToArchiveAppException exception)
            {
                return(Ok(exception));
            }
        }