public ActionResult Create(Doctor doctor) { if (ModelState.IsValid) { db.Doctors.Add(doctor); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.SpecializationId = new SelectList(db.Specializations, "SpecializationId", "SpecializationName", doctor.SpecializationId); return View(doctor); }
public ActionResult Edit(Doctor doctor) { if (ModelState.IsValid) { db.Entry(doctor).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.SpecializationId = new SelectList(db.Specializations, "SpecializationId", "SpecializationName", doctor.SpecializationId); return View(doctor); }