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