public IActionResult Edit(int id, [Bind("IdDoctor,FirstName,LastName,Birthday")] Patient patient) { if (id != patient.IdPatient) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(patient); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!_context.Patient.Any(e => e.IdPatient == id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(patient)); }
public async Task <IActionResult> Edit(int id, [Bind("IdDoctor,FirstName,LastName,Email")] Doctor doctor) { if (id != doctor.IdDoctor) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(doctor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DoctorExists(doctor.IdDoctor)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(doctor)); }