public ActionResult DeleteConfirmed(int id) { if (string.IsNullOrEmpty(Convert.ToString(Session["UserID"]))) { return(RedirectToAction("Login", "Home")); } BookTypeTable bookTypeTable = db.BookTypeTables.Find(id); db.BookTypeTables.Remove(bookTypeTable); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(BookTypeTable bookTypeTable) { if (string.IsNullOrEmpty(Convert.ToString(Session["UserID"]))) { return(RedirectToAction("Login", "Home")); } int userid = Convert.ToInt32(Convert.ToString(Session["UserID"])); bookTypeTable.UserID = userid; if (ModelState.IsValid) { db.Entry(bookTypeTable).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bookTypeTable)); }
// GET: BookTypeTables/Edit/5 public ActionResult Edit(int?id) { if (string.IsNullOrEmpty(Convert.ToString(Session["UserID"]))) { return(RedirectToAction("Login", "Home")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BookTypeTable bookTypeTable = db.BookTypeTables.Find(id); if (bookTypeTable == null) { return(HttpNotFound()); } return(View(bookTypeTable)); }