Example #1
0
        internal void EditKhuyenMai(KMAI loai)
        {
            KMAI lsp = db.KMAIs.Find(loai.MAKM);

            lsp.NGAYBATDAU      = loai.NGAYBATDAU;
            lsp.NGAYKETTHUC     = loai.NGAYKETTHUC;
            lsp.NOIDUNG         = loai.NOIDUNG;
            db.Entry(lsp).State = EntityState.Modified;
            db.SaveChanges();
        }
Example #2
0
        public void UpdateSoluong(string masp, int?sl, bool?kt)
        {
            var s = db.SPHAMs.Find(masp);

            if (sl != null)
            {
                if (kt == true)
                {
                    s.SOLUONG += sl;
                }
                else if (kt == false)
                {
                    s.SOLUONG -= sl;
                }
                db.Entry(s).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }