public async Task <IActionResult> PutCustomer(int id, Customer customer) { if (id != customer.CustomerID) { return(BadRequest()); } _context.Entry(customer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit(Patient patient, int DoctorId) { if (DoctorId != 0) { _db.DoctorPatientSpecialties.Add(new DoctorPatientSpecialty() { DoctorId = DoctorId, PatientId = patient.PatientId }); } _db.Entry(patient).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task PutEmployeeAsync(Guid id, IEmployee employee) { _context.Entry(employee).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { throw new KeyNotFoundException(); } else { throw new Exception(); } } }
public ActionResult Edit(Doctor doctor) { _db.Entry(doctor).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); }