public ActionResult SaveEdit(DateTime ngayBD, DateTime ngKT, int MucGiam, string idCTKM, string idTG) { var message = 0; var thoigian = new THOIGIAN(); thoigian.MATHOIGIAN = idTG; thoigian.THOIGIANBATDAU = ngayBD; thoigian.THOIGIANKETTHUC = ngKT; var giatri = new CHUONGTRINH_KHUYENMAI(); giatri.MACHUONGTRINHKHUYENMAI = idCTKM; giatri.MUCGIAMGIA = MucGiam; message = new SanPhamDao().updateCTKM(thoigian, giatri); return(Json(message, JsonRequestBehavior.AllowGet)); }
public int updateCTKM(THOIGIAN tg, CHUONGTRINH_KHUYENMAI ct) { try { var thoigian = db.THOIGIANs.Find(tg.MATHOIGIAN); thoigian.THOIGIANBATDAU = tg.THOIGIANBATDAU; thoigian.THOIGIANKETTHUC = tg.THOIGIANKETTHUC; var chuongtrinh = db.CHUONGTRINH_KHUYENMAI.Find(ct.MACHUONGTRINHKHUYENMAI); chuongtrinh.MUCGIAMGIA = ct.MUCGIAMGIA; db.SaveChanges(); return(1); } catch { return(0); } }