// GET: LibraryUser/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LibraryUsers libraryUsers = db.LibraryUsers.Find(id); if (libraryUsers == null) { return(HttpNotFound()); } return(View(libraryUsers)); }
public ActionResult DeleteConfirmed(int id) { try { LibraryUsers libraryUsers = db.LibraryUsers.Find(id); db.LibraryUsers.Remove(libraryUsers); db.SaveChanges(); } catch (DataException) { ModelState.AddModelError("", "Unable to save changes."); } return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "FirstName,LastName,OIB")] LibraryUsers libraryUsers) { try { if (ModelState.IsValid) { db.Entry(libraryUsers).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } catch (DataException de) { ModelState.AddModelError("", "Unable to save changes." + de.Message); } return(View(libraryUsers)); }
public ActionResult Create([Bind(Include = "FirstName,LastName,OIB")] LibraryUsers libraryUsers) { try { if (ModelState.IsValid) { db.LibraryUsers.Add(libraryUsers); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (DataException) { ModelState.AddModelError("", "Unable to save changes."); } return(View(libraryUsers)); }