Beispiel #1
0
        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);
        }
Beispiel #2
0
 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);
 }