public ActionResult DeleteConfirmed(int id) { Tailieu tailieu = db.tailieus.Find(id); db.tailieus.Remove(tailieu); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Title,ReleaseDate,GenreID,Price,Picture,Rating,Sumary")] Tailieu tailieu) { if (ModelState.IsValid) { db.Entry(tailieu).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GenreID = new SelectList(db.genres, "genreID", "genreName", tailieu.GenreID); return(View(tailieu)); }
// GET: Tailieux/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Tailieu tailieu = db.tailieus.Find(id); if (tailieu == null) { return(HttpNotFound()); } return(View(tailieu)); }
// GET: Tailieux/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Tailieu tailieu = db.tailieus.Find(id); if (tailieu == null) { return(HttpNotFound()); } ViewBag.GenreID = new SelectList(db.genres, "genreID", "genreName", tailieu.GenreID); return(View(tailieu)); }
public ActionResult Create([Bind(Include = "ID,Title,ReleaseDate,GenreID,Price,Picture,Rating,Sumary")] Tailieu tailieu) { tailieu.Picture = new byte[tailieu.PictureUpload.ContentLength]; tailieu.PictureUpload.InputStream.Read(tailieu.Picture, 0, tailieu.PictureUpload.ContentLength); if (ModelState.IsValid) { db.tailieus.Add(tailieu); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GenreID = new SelectList(db.genres, "genreID", "genreName", tailieu.GenreID); return(View(tailieu)); }