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))); } }
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!")); } }