public ActionResult EditSP([Bind(Include = "MaSP,TenSP,LoaiSP,HangSX,XuatXu,GiaGoc,MoTa,SoLuong,isnew,ishot,GioiThieu,ThongSoKyThuat")] SanPham sanpham, HttpPostedFileBase ad, HttpPostedFileBase an, HttpPostedFileBase ak) { SanPhamModel spm = new SanPhamModel(); if (ModelState.IsValid) { spm.EditSP(sanpham); UploadAnh(ad, sanpham.MaSP + "1"); UploadAnh(an, sanpham.MaSP + "2"); UploadAnh(ak, sanpham.MaSP + "3"); return(RedirectToAction("SanPham")); } ViewBag.HangSX = new SelectList(spm.GetAllHangSX(), "HangSX", "TenHang", sanpham.HangSX); ViewBag.LoaiSP = new SelectList(spm.GetAllLoaiSP(), "MaLoai", "TenLoai", sanpham.LoaiSP); return(View(sanpham)); }
public ActionResult EditSP([Bind(Include = "Id,TenSP,LoaiSpId,Id,XuatXu,GiaGoc,MoTa,SoLuong,isnew,ishot")] SanPham sanpham, HttpPostedFileBase ad, HttpPostedFileBase an, HttpPostedFileBase ak) { var spm = new SanPhamModel(); if (ModelState.IsValid) { spm.EditSP(sanpham); UploadAnh(ad, sanpham.Id + "1"); UploadAnh(an, sanpham.Id + "2"); UploadAnh(ak, sanpham.Id + "3"); return(RedirectToAction("SanPham")); } ViewBag.HangSX = new SelectList(spm.GetAllHangSX(), "Id", "TenHang", sanpham.HangSxId); ViewBag.LoaiSP = new SelectList(spm.GetAllLoaiSP(), "Id", "TenLoai", sanpham.LoaiSpId); return(View(sanpham)); }