public ActionResult DeleteConfirmed(int id) { Book_Type book_Type = db.Book_Type.Find(id); db.Book_Type.Remove(book_Type); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Type_Name")] Book_Type book_Type) { if (ModelState.IsValid) { db.Entry(book_Type).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(book_Type)); }
public ActionResult Create([Bind(Include = "Id,Type_Name")] Book_Type book_Type) { if (ModelState.IsValid) { db.Book_Type.Add(book_Type); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(book_Type)); }
// GET: Admin/Book_Type/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Book_Type book_Type = db.Book_Types.Find(id); if (book_Type == null) { return(HttpNotFound()); } return(View(book_Type)); }
// GET: Admin/Book_Type/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Book_Type book_Type = db.Book_Types.Find(id); if (book_Type == null) { return(HttpNotFound()); } ViewBag.Bookid = new SelectList(db.Books, "ID", "Name", book_Type.Bookid); ViewBag.Typeid = new SelectList(db.Types, "ID", "Type", book_Type.Typeid); return(View(book_Type)); }
public ActionResult Create([Bind(Include = "ID,Typeid,Bookid,CreateDate,CreateUserID,UpdateDate,UpdateUserID")] Book_Type book_Type) { if (ModelState.IsValid) { User user = Session["AdminLogin"] as User; book_Type.CreateDate = DateTime.Now; book_Type.CreateUserID = user.ID; db.Book_Types.Add(book_Type); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Bookid = new SelectList(db.Books, "ID", "Name", book_Type.Bookid); ViewBag.Typeid = new SelectList(db.Types, "ID", "Type", book_Type.Typeid); return(View(book_Type)); }
// GET: Books/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Book book = db.Book.Find(id); Book_Language language = db.Book_Language.FirstOrDefault(b => b.Id == book.LanguageId); Book_Type book_Type = db.Book_Type.FirstOrDefault(t => t.Id == book.TypeId); User publisher = db.Users.FirstOrDefault(p => p.Id == book.PublisherId); if (book == null) { return(HttpNotFound()); } return(View(book)); }
// GET: BookType/Edit/5 public ActionResult Edit(int?id) { if (UserAuthentication.UserCheck(1)) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Book_Type book_Type = db.Book_Type.Find(id); if (book_Type == null) { return(HttpNotFound()); } return(View(book_Type)); } else { return(RedirectToAction("Home", "Home")); } }