コード例 #1
0
 public async Task <CommandResult> Incluir(IncluirSalaCommand command)
 {
     try
     {
         return(await _handler.Handle(command));
     }
     catch (Exception ex)
     {
         return(await Task.FromResult(new CommandResult(false, ex.Message)));
     }
 }
コード例 #2
0
        public async Task <IActionResult> Create([FromBody] User user)
        {
            try
            {
                var userCreated = await _mediator.Handle(new CreateUserRequest(user.Name, user.Email));

                return(Ok(userCreated));
            }
            catch (Exception)
            {
                return(StatusCode(500, "Ocorreu algum erro interno na aplicaçao. Por favor tente novamente!"));
            }
        }