public async Task Consume(ConsumeContext <UserRequestDto> context) { try { var result = await _operationUsers.GetByIdUserAsync(context.Message.UserGuid); var user = _mapper.Map <UserDto>(result); await context.RespondAsync(new UserResponseDto { UserDto = user }); } catch (NoUserFoundException e) { await context.RespondAsync(new NoUserFound { CodeException = e.CodeException, MassageException = $"{e.Message}" }); } catch (Exception e) { await context.RespondAsync(new NoUserFound { MassageException = $"{e.Message}" }); } }
public async Task <IActionResult> GetUserById(Guid userGuid) { try { var result = await _operationUsers.GetByIdUserAsync(userGuid); return(Ok(result)); } catch (NoUserFoundException exception) { return(Ok(exception)); } }