public JsonResult DeletarPaciente(int id) { try { _pacienteService.Buscar(id); _pacienteService.Excluir(id); return(new JsonResult("Excluido com sucesso") { StatusCode = 200 }); } 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 }); } }