public ActionResult DeleteConfirmed(int id) { Writer_Book writer_Book = db.Writer_Books.Find(id); db.Writer_Books.Remove(writer_Book); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Admin/Writer_Book/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Writer_Book writer_Book = db.Writer_Books.Find(id); if (writer_Book == null) { return(HttpNotFound()); } return(View(writer_Book)); }
public ActionResult Edit([Bind(Include = "ID,Writerid,Bookid,CreateDate,CreateUserID,UpdateDate,UpdateUserID")] Writer_Book writer_Book) { if (ModelState.IsValid) { User user = Session["AdminLogin"] as User; writer_Book.UpdateDate = DateTime.Now; writer_Book.UpdateUserID = user.ID; db.Entry(writer_Book).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Bookid = new SelectList(db.Books, "ID", "Name", writer_Book.Bookid); ViewBag.Writerid = new SelectList(db.Writers, "ID", "Name", writer_Book.Writerid); return(View(writer_Book)); }
// GET: Admin/Writer_Book/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Writer_Book writer_Book = db.Writer_Books.Find(id); if (writer_Book == null) { return(HttpNotFound()); } ViewBag.Bookid = new SelectList(db.Books, "ID", "Name", writer_Book.Bookid); ViewBag.Writerid = new SelectList(db.Writers, "ID", "Name", writer_Book.Writerid); return(View(writer_Book)); }