public async Task <IActionResult> Update(int id, string Diagonosis) { var testimony = new Prescription() { PrescriptionId = id, PrescriptionCollected = true, Diagonosis = Diagonosis }; _context.Prescription.Attach(testimony); _context.Entry(testimony).Property(x => x.PrescriptionCollected).IsModified = true; _context.Entry(testimony).Property(x => x.Diagonosis).IsModified = true; await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> PutPatient([FromRoute] int id, [FromBody] Patient patient) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != patient.PatientId) { return(BadRequest()); } _context.Entry(patient).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PatientExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }