public JsonResult FinalizarConsulta(int id_consulta) { try { _consultaService.FinalizarConsulta(id_consulta); return(new JsonResult("Consulta finalizada com sucesso") { StatusCode = 200 }); } catch (PacienteNaoExisteException exception) { return(new JsonResult(exception.Message) { StatusCode = 406 }); } catch (PacienteNaoCorrespondeAEstaConsultaException exception) { return(new JsonResult(exception.Message) { StatusCode = 406 }); } catch (ConsultaNaoExisteException 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 }); } }