Пример #1
0
 public RedirectToRouteResult CachInvoice(Cart cart)
 {
     foreach (var item in cart.lines)
     {
         Product MyProduct = _productManger.GettAll().Where(c => c.Id == item.Product.Id).First();
         MyProduct.Quentity = MyProduct.Quentity - item.Quantity;
         _productManger.Save();
     }
     return(RedirectToAction("List", "Product"));
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Category category = _CategoryManger.GetBy(id);

            category.IsArchived = true;
            category.HiddInMenu = true;
            List <Product> MyProductList = new List <Product>();

            MyProductList = _ProductManger.GettAll().Where(c => c.CategoryId == category.Id).ToList();
            foreach (var item in MyProductList)
            {
                item.IsArchived = true;
            }
            _ProductManger.Save();
            _CategoryManger.Save();
            return(RedirectToAction("Index"));
        }
Пример #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Product product   = _productManger.GetBy(id);
            var     Myproduct = product.CategoryId;
            var     maybe     = _productManger.GetAllBind().Where(c => c.CategoryId == Myproduct && c.IsArchived == false);

            product.IsArchived = true;

            if (maybe.FirstOrDefault() == null)
            {
                Category category = _categoryManger.GetBy(product.CategoryId);
                category.HiddInMenu = true;
                _categoryManger.Save();
            }

            _productManger.Save();

            return(RedirectToAction("Index"));
        }