public ActionResult Edit([Bind(Include = "Ms,Ten_sach,Don_gia,Don_vi_tinh,Mo_ta,Hinh_minh_hoa,Mcd,Mnxb,Ngay_cap_nhat,So_luong_ban,So_lan_xem,so_luong_con")] SACH sACH) { if (ModelState.IsValid) { db.Entry(sACH).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Mcd = new SelectList(db.CHU_DE, "Mcd", "Ten_chu_de", sACH.Mcd); ViewBag.Mnxb = new SelectList(db.NHA_XUAT_BAN, "Mnxb", "Ten_nha_xuat_ban", sACH.Mnxb); return(View(sACH)); }
public ActionResult Edit(int?id, SACH obj) { var books = db.SACH.Find(id); //SACH objBook = new SACH(); //objBook.Ten_sach = Request.Form["Ten_sach"]; books.Ten_sach = Request.Form["Ten_sach"]; books.Don_gia = Decimal.Parse(Request.Form["Don_gia"]); books.Don_vi_tinh = Request.Form["Don_vi_tinh"]; books.Mo_ta = Request.Form["Mo_ta"]; books.Hinh_minh_hoa = Request.Form["Hinh_minh_hoa"]; //books.Mcd = Int32.Parse(Request.Form["Mcd"]); //books.Mnxb = Int32.Parse(Request.Form["Mnxb"]); db.Entry(books).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }