Exemple #1
0
 public async Task <IActionResult> Update(int id, [FromBody] AtualizarUsuarioRequest usuario)
 {
     try
     {
         return(Ok(await _usuarioApp.Atualizar(id, usuario)));
     }
     catch (ValidationException valEx)
     {
         return(BadRequest(new ErroGenerico {
             Mensagem = valEx.Message
         }));
     }
 }
Exemple #2
0
        public Task <HttpResponseMessage> Put(Guid id, [FromBody] dynamic body)
        {
            var usuarioCommand = new UsuarioCommand(
                email: (string)body.email,
                senha: (string)body.confirmarSenha,
                perfil: (int)body.perfil,
                estaAtivo: (bool)body.estaAtivo,
                idPessoa: (Guid)body.idPessoa
                );

            var usuario = _usuarioApp.Atualizar(usuarioCommand);

            return(CreateResponse(HttpStatusCode.OK, usuario));
        }