public int them(Discount dc)
 {
     dc.createdAt = DateTime.Now;
     dc.status    = true;
     db.Discounts.Add(dc);
     db.SaveChanges();
     return(dc.discountId);
 }
        public ActionResult UpdateStatus(int orderId, string status)
        {
            var _dh = new DonHang()
            {
                orderId = orderId, status = status
            };

            db.DonHangs.Attach(_dh);
            db.Entry(_dh).Property(X => X.status).IsModified = true;
            db.SaveChanges();
            return(RedirectToAction("Details", new { id = orderId }));
        }
 public int Them(SlideNewProduct item)
 {
     try
     {
         db.SlideNewProducts.Add(item);
         db.SaveChanges();
         return(item.slideId);
     }
     catch (Exception)
     {
         return(-1);
     }
 }
Exemple #4
0
 public int add(TheLoai tl)
 {
     try
     {
         tl.createdDate = DateTime.Now;
         db.TheLoais.Add(tl);
         db.SaveChanges();
         return(tl.id);
     }
     catch (Exception)
     {
         return(-1);
     }
 }
Exemple #5
0
        public Boolean them(KhachHang kh)
        {
            var checkEmailExist = db.KhachHangs.Where(item => item.email == kh.email);

            if (checkEmailExist.Count() > 0)
            {
                return(false);
            }
            kh.createdAt = DateTime.Now;
            kh.isAdmin   = kh.isAdmin == null || kh.isAdmin == false ? false : true;
            db.KhachHangs.Add(kh);
            db.SaveChanges();
            return(true);
        }
Exemple #6
0
 public void them(DonHang dh)
 {
     db.DonHangs.Add(dh);
     db.SaveChanges();
 }