public async Task <IActionResult> Put(int medicoConsultaId, MedicoConsulta model) { try { var medicoConsulta = await _medCons.GetMedicoConsultaAsyncById(medicoConsultaId); if (medicoConsulta == null) { return(NotFound()); } _medCons.update(model); if (await _medCons.SaveChangesAsync()) { return(Created($"/api/medicoConsulta/{model.Id}", model)); } } catch (System.Exception) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Falha no Banco de dados")); } return(BadRequest()); }
public async Task <IActionResult> Put(int funcionarioId, Funcionario model) { try { var funcionario = await _fun.GetFuncionarioAsyncById(funcionarioId); if (funcionario == null) { return(NotFound()); } _fun.update(model); if (await _fun.SaveChangesAsync()) { return(Created($"/api/funcionario/{model.Id}", model)); } } catch (System.Exception) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Falha no Banco de dados")); } return(BadRequest()); }
public async Task <IActionResult> Put(int medicoId, Medico model) { try { var medico = await _med.GetMedicoAsyncById(medicoId); if (medico == null) { return(NotFound()); } _med.update(model); //_fun.update(model.Pessoa.Usuario); if (await _med.SaveChangesAsync()) { return(Created($"/api/medico/{model.Id}", model)); } } catch (System.Exception ex) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Falha no Banco de dados")); } return(BadRequest()); }
public async Task <IActionResult> Put(int pacienteId, Paciente model) { try { var paciente = await _pac.GetPacienteAsyncById(pacienteId); if (paciente == null) { return(NotFound()); } _pac.update(model); if (await _pac.SaveChangesAsync()) { return(Created($"/api/paciente/{model.Id}", model)); } } catch (System.Exception) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Falha no Banco de dados")); } return(BadRequest()); }