public ActionResult Edit([Bind(Include = "MaSP,MaDM,MaKM,TenSP,NhanHieu,GioiTinh,Gia,XuatXu,TgPhatHanh,NongDo,NhaPC,NhomHuong,PhongCach,MoTa,MauSac,BoSuuTap,HuongDacTrung,Anh")] SanPham sanPham) { try { if (ModelState.IsValid) { var f = Request.Files["ImageFile"]; if (f != null && f.ContentLength > 0) { string FileName = Path.GetFileName(f.FileName); string UpLoadFile = Server.MapPath("~/wwwroot/Images/") + FileName; f.SaveAs(FileName); sanPham.Anh = FileName; } db.Entry(sanPham).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = "Lỗi" + ex.Message; ViewBag.MaDM = new SelectList(db.DanhMucs, "MaDM", "TenDM", sanPham.MaDM); ViewBag.MaKM = new SelectList(db.KhuyenMais, "MaKM", "MaKM", sanPham.MaKM); return(View(sanPham)); } }
public ActionResult Edit([Bind(Include = "MaBlog,Anh,NoiDung,TieuDe")] Blog blog) { try { if (ModelState.IsValid) { var f = Request.Files["ImageFile"]; if (f != null && f.ContentLength > 0) { string FileName = Path.GetFileName(f.FileName); string UpLoadFile = Server.MapPath("~/wwwroot/Images/") + FileName; f.SaveAs(FileName); blog.Anh = FileName; } db.Entry(blog).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = "Lỗi dữ liệu" + ex.Message; return(View(blog)); } }
public ActionResult Edit([Bind(Include = "MaKH,HoTen,SDT,DiaChi,Email")] KhachHang khachHang) { if (ModelState.IsValid) { db.Entry(khachHang).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(khachHang)); }
public ActionResult Edit([Bind(Include = "MaLH,HoTenKH,Email,SDT,DiaChi,NoiDung")] LienHe lienHe) { if (ModelState.IsValid) { db.Entry(lienHe).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(lienHe)); }
public ActionResult UserTT([Bind(Include = "MaTK,HoTen,Email,DiaChi,SDT,TenDangNhap,MatKhau,Quyen")] TaiKhoan taiKhoan) { if (ModelState.IsValid) { db.Entry(taiKhoan).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(taiKhoan)); }
public ActionResult Edit([Bind(Include = "MaKM,GiaKM,NgayBD,NgayKT")] KhuyenMai khuyenMai) { if (ModelState.IsValid) { db.Entry(khuyenMai).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(khuyenMai)); }
public ActionResult Edit([Bind(Include = "MaSP,MaDH,SoLuongBan")] ChiTietDH chiTietDH) { if (ModelState.IsValid) { db.Entry(chiTietDH).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaDH = new SelectList(db.DonHangs, "MaDH", "DiaChiGH", chiTietDH.MaDH); ViewBag.MaSP = new SelectList(db.SanPhams, "MaSP", "TenSP", chiTietDH.MaSP); return(View(chiTietDH)); }
public ActionResult Edit([Bind(Include = "MaTK,HoTen,Email,DiaChi,SDT,TenDangNhap,MatKhau,Quyen")] TaiKhoan taiKhoan) { try { if (ModelState.IsValid) { db.Entry(taiKhoan).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = "Lỗi" + ex.Message; return(View(taiKhoan)); } }
public ActionResult Edit([Bind(Include = "MaDM,TenDM")] DanhMuc danhMuc) { try { if (ModelState.IsValid) { db.Entry(danhMuc).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = "Lỗi" + ex.Message; return(View(danhMuc)); } }
public ActionResult Edit([Bind(Include = "MaBL,HoTen,Email,NoiDung,ThoiGian,MaSP")] BinhLuan binhLuan) { try { if (ModelState.IsValid) { db.Entry(binhLuan).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = "Lỗi" + ex.Message; ViewBag.MaSP = new SelectList(db.SanPhams, "MaSP", "TenSP", binhLuan.MaSP); return(View(binhLuan)); } }
public ActionResult Edit([Bind(Include = "MaDH,NgayLap,DiaChiGH,HinhThucTT,TongTien,GhiChu,MaKH")] DonHang donHang) { try { if (ModelState.IsValid) { db.Entry(donHang).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = "Lỗi" + ex.Message; ViewBag.MaKH = new SelectList(db.KhachHangs, "MaKH", "HoTen", donHang.MaKH); return(View(donHang)); } }