//Thay đổi tình trạng giao hàng
 public int ChangeStatus(long id)
 {
     try
     {
         var bill = db.Bills.Find(id);
         if (bill.Status == 0)
         {
             bill.Status = 1;
         }
         else if (bill.Status == 1)
         {
             bill.Status = 2;
         }
         else if (bill.Status == 2)
         {
             bill.Status = 3;
         }
         else if (bill.Status == 3)
         {
             bill.Status = 4;
         }
         else if (bill.Status == 4)
         {
             bill.Status = 5;
         }
         //user.Status = !user.Status;
         db.SaveChanges();
         return(bill.Status);
     }
     catch
     {
         return(-1);
     }
 }
Exemple #2
0
        //
        public bool ChangeStatus(long id)
        {
            var category = db.ProductCategories.Find(id);

            category.ShowOnHome = !category.ShowOnHome;
            db.SaveChanges();
            return(category.ShowOnHome);
        }
Exemple #3
0
        //
        public bool ChangeStatus(long id)
        {
            var notification = db.Notifications.Find(id);

            notification.Show = !notification.Show;
            db.SaveChanges();
            return(notification.Show);
        }
Exemple #4
0
        //
        public bool ChangeStatus(long id)
        {
            var product = db.Products.Find(id);

            product.Status = !product.Status;
            db.SaveChanges();
            return(product.Status);
        }
Exemple #5
0
 public long insert(ProductRate entity)
 {
     try
     {
         db.ProductRates.Add(entity);
         db.SaveChanges();
         return(entity.ID);
     }
     catch (Exception ex)
     {
         return(-1);
     }
 }
Exemple #6
0
 //Thêm, xóa, sửa
 public long insert(BillDetail entity)
 {
     try
     {
         db.BillDetails.Add(entity);
         db.SaveChanges();
         return(entity.BillID);
     }
     catch
     {
         return(-1);
     }
 }
 public long Insert(Cart entity)
 {
     try
     {
         db.Carts.Add(entity);
         db.SaveChanges();
         return(entity.CartID);
     }
     catch (Exception ex)
     {
         return(-1);
     }
 }
        public bool ChangeStatus(long id)
        {
            var user = db.Users.Find(id);

            user.Status = !user.Status;
            db.SaveChanges();
            return(user.Status);
        }
Exemple #9
0
        public long insert(EmployeeViewModel entity)
        {
            var emp = db.Employees.SingleOrDefault(x => x.EmpID == entity.EmpID);

            if (emp == null)
            {
                var employee = new Employee();
                employee.EmpID  = entity.EmpID;
                employee.Salary = entity.Salary;
                db.Employees.Add(employee);
                db.SaveChanges();
                var user = db.Users.Find(entity.EmpID);
                user.GroupID = entity.GroupID;
                db.SaveChanges();
                return(entity.EmpID);
            }
            return(-1);
        }