Beispiel #1
0
        public async Task Consume(ConsumeContext <GuidAuthorRequestDto> context)
        {
            try
            {
                var authorGuid = await _operationAuthors.GetGuidByNikeNameAuthorAsync(context.Message.NikeNameAuthor);

                await context.RespondAsync(new GuidAuthorResponseDto
                {
                    AuthorGuid = authorGuid
                });
            }
            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}"
                });
            }
        }
Beispiel #2
0
        public async Task <IActionResult> GetGuidByNikeNameAuthorAsync(string authorNikeName)
        {
            try
            {
                var result = await _operationAuthors.GetGuidByNikeNameAuthorAsync(authorNikeName);

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