Beispiel #1
0
        public JsonResult AlterarPaciente([FromBody] PacienteModel paciente)
        {
            try
            {
                PacienteModel pacienteAlterado = _pacienteService.Alterar(paciente);

                return(new JsonResult(pacienteAlterado)
                {
                    StatusCode = 201
                });
            }
            catch (PacienteNaoExisteException exception)
            {
                return(new JsonResult(exception.Message)
                {
                    StatusCode = 406
                });
            }
            catch (NaoFoiPossivelConectarNoBancoDeDadosException exception)
            {
                return(new JsonResult(exception.Message)
                {
                    StatusCode = 406
                });
            }
            catch (Exception exception)
            {
                return(new JsonResult(exception.Message)
                {
                    StatusCode = 500
                });
            }
        }