Beispiel #1
0
        public void deletesp(string id)
        {
            SPHAM sp = db.SPHAMs.Find(id);

            db.SPHAMs.Remove(sp);
            db.SaveChanges();
        }
        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();
        }
 internal string ThemLoaiSP(LSANPHAM loai)
 {
     loai.MALOAI = TaoMa();
     db.LSANPHAMs.Add(loai);
     db.SaveChanges();
     return(loai.MALOAI);
 }
        public ActionResult UpdateUser(USSER user)
        {
            Shopbanhang db = new Shopbanhang();

            if (ModelState.IsValid)
            {
                try
                {
                    var edituser = db.USSERs.Find(user.ID);
                    edituser.USERNAME      = user.USERNAME;
                    edituser.NAME          = user.NAME;
                    edituser.ADDRESS       = user.ADDRESS;
                    edituser.EMAIL         = user.EMAIL;
                    edituser.PHONE         = user.PHONE;
                    edituser.MODDIFIEDDATE = DateTime.Now;
                    edituser.CREATEBY      = "User";
                    db.SaveChanges();
                    return(View("EditUser"));
                }
                catch
                {
                    ModelState.AddModelError("", "Cập nhật user không thành công");
                }
            }
            return(View("EditUser"));
        }
 internal string ThemHangSX(HSANXUAT loai)
 {
     loai.HANGSX = TaoMa();
     db.HSANXUATs.Add(loai);
     db.SaveChanges();
     return(loai.HANGSX);
 }
 public ActionResult Thaydoimatkhau(string matkhaumoi, string nhaplaimatkhau, int?id, string Token)
 {
     if (matkhaumoi != nhaplaimatkhau)
     {
         ViewBag.TB = "Mật khẩu không đúng! ";
         return(View());
     }
     else
     {
         db.USSERs.Find(id).PASS = matkhaumoi;
         db.SaveChanges();
         return(Redirect("/"));
     }
 }
        public JsonResult savedata(string struser)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            USSER user   = serializer.Deserialize <USSER>(struser);
            bool  status = false;

            if (user.ID == 0)
            {
                db.USSERs.Add(user);
                db.SaveChanges();
                status = true;
            }
            return(Json(new
            {
                status = status
            }));
        }
Beispiel #8
0
 public long insert(USSER entity)
 {
     db.USSERs.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }