public async Task <IActionResult> Put(int medicoId, Medico model) { try { var medico = await _med.GetMedicoAsyncById(medicoId); if (medico == null) { return(NotFound()); } _med.update(model); if (await _med.SaveChangesAsync()) { return(Created($"/api/medico/{model.Id}", model)); } } catch (System.Exception) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Falha no Banco de dados")); } return(BadRequest()); }
public async Task <IActionResult> Get(int medicoId) { try { var results = await _med.GetMedicoAsyncById(medicoId); return(Ok(results)); } catch (System.Exception ex) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Falha no Banco de dados")); } }