public ActionResult Create(Librarian librarian) { if (ModelState.IsValid) { db.Librarians.Add(librarian); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.LibrarianID = new SelectList(db.Users, "UserID", "UserName", librarian.LibrarianID); return View(librarian); }
public ActionResult Edit(Librarian librarian) { if (ModelState.IsValid) { db.Entry(librarian).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.LibrarianID = new SelectList(db.Users, "UserID", "UserName", librarian.LibrarianID); return View(librarian); }