public ActionResult SuaCTKhuyenMai(List <SanPhamKhuyenMai> lstkt) { if (lstkt.Count == 0) { return(RedirectToAction("Index")); } KhuyenMaiModel spm = new KhuyenMaiModel(); spm.DelAllSPKM(lstkt[0].MaKM); foreach (var item in lstkt) { if (!string.IsNullOrEmpty(item.MaSP) && !string.IsNullOrEmpty(item.MaKM)) { spm.ThemSPKhuyenMai(item); } } return(RedirectToAction("Index")); }
public ActionResult SuaCTKhuyenMai(List <SanPhamKhuyenMai> lstkt) { if (lstkt.Count == 0) { return(RedirectToAction("Index")); } var spm = new KhuyenMaiModel(); spm.DelAllSPKM(lstkt[0].KhuyenMaiId); foreach (var item in lstkt) { if (item.SanPhamId > 0 && item.KhuyenMaiId > 0) { spm.ThemSPKhuyenMai(item); } } return(RedirectToAction("Index")); }