public ActionResult Edit([Bind(Include = "SachID,TenSach,GiaBan,MaChuDe,NhaXuatBanID,MoTa,HinhBia,SoTrang,TrongLuong,NgayCapNhat,SoLanXem,SoLuongBan,HetHang")] Sach sach) { if (ModelState.IsValid) { db.Entry(sach).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaChuDe = new SelectList(db.ChuDes, "MaChuDe", "TenChuDe", sach.MaChuDe); ViewBag.NhaXuatBanID = new SelectList(db.NhaXuatBans, "NhaXuatBanID", "TenNhaXuatBan", sach.NhaXuatBanID); return(View(sach)); }
public async Task <ActionResult> Edit([Bind(Include = "UserID,TaiKhoan,MatKhau,TrangThai,Email,RoleID")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; await db.SaveChangesAsync(); var item = db.Users.SingleOrDefault(x => x.UserID == user.UserID); var nguoiDung = Session["NguoiDung"] as User; var listLog = Session["Log"] as LogModel; if (listLog == null) { listLog = new LogModel(); Session["Log"] = listLog; } LogItem logItem = new LogItem(); logItem.ThongBao = $"Người dùng {nguoiDung.TaiKhoan} đã cập nhật thông tin của người dùng {item.TaiKhoan}"; logItem.ThoiGian = DateTime.Now; listLog.Add(logItem); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.RoleID = new SelectList(db.UserRoles, "RoleID", "TenRole", user.RoleID); return(View(user)); }
public ActionResult Edit([Bind(Include = "NhaXuatBanID,TenNhaXuatBan,DiaChi,DienThoai")] NhaXuatBan nhaXuatBan) { if (ModelState.IsValid) { db.Entry(nhaXuatBan).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nhaXuatBan)); }
public ActionResult Edit([Bind(Include = "DatHangID,KhachHangID,NgayDatHang,TriGia,DaGiao,NgayGiao,HoTen,DiaChi,DienThoai,Email")] DatHang datHang) { if (ModelState.IsValid) { db.Entry(datHang).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(datHang)); }
public ActionResult Edit([Bind(Include = "MaChuDe,TenChuDe")] ChuDe chuDe) { if (ModelState.IsValid) { db.Entry(chuDe).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(chuDe)); }