public ActionResult DeleteConfirmed(string id) { tSach tSach = db.tSaches.Find(id); db.tSaches.Remove(tSach); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "MaSach,TenSach,MaLoai,MaNgonNgu,MaNXB,TacGia,NamXB,LanXB,GioiThieu,TongSoTrang,Tap,TongSoTap,GiaTriSach,FileAnh")] tSach tSach) { if (ModelState.IsValid) { db.Entry(tSach).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaLoai = new SelectList(db.tLoaiSaches, "MaLoai", "TenLoai", tSach.MaLoai); ViewBag.MaNgonNgu = new SelectList(db.tNgonNgus, "MaNgonNgu", "TenNgonNgu", tSach.MaNgonNgu); ViewBag.MaNXB = new SelectList(db.tNhaXBs, "MaNXB", "TenNXB", tSach.MaNXB); return(View(tSach)); }
// GET: Home/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tSach tSach = db.tSaches.Find(id); if (tSach == null) { return(HttpNotFound()); } return(View(tSach)); }
// GET: Home/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tSach tSach = db.tSaches.Find(id); if (tSach == null) { return(HttpNotFound()); } ViewBag.MaLoai = new SelectList(db.tLoaiSaches, "MaLoai", "TenLoai", tSach.MaLoai); ViewBag.MaNgonNgu = new SelectList(db.tNgonNgus, "MaNgonNgu", "TenNgonNgu", tSach.MaNgonNgu); ViewBag.MaNXB = new SelectList(db.tNhaXBs, "MaNXB", "TenNXB", tSach.MaNXB); return(View(tSach)); }