public async Task <IActionResult> PutTbPatient(int id, TbPatient tbPatient) { DateTime actual = DateTime.Now; tbPatient.DateUpdatedPatient = actual; if (id != tbPatient.IdPatient) { return(BadRequest()); } _context.Entry(tbPatient).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TbPatientExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TbPatient> > PostTbPatient(TbPatient tbPatient) { DateTime actual = DateTime.Now; tbPatient.DateCreatedPatient = actual; _context.TbPatients.Add(tbPatient); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTbPatient", new { id = tbPatient.IdPatient }, tbPatient)); }