public RedirectToRouteResult AddToCart(Cart cart, int productId, string returnUrl)
        {
            var product = itemLogic.GetItemByID(productId);

            if (product != null)
            {
                cart.AddItem(product, 1);
            }

            return RedirectToAction("Index", new { returnUrl });
        }
Beispiel #2
0
        public RedirectToRouteResult AddToCart(Cart cart, int productId, string returnUrl)
        {
            var product = _productRepository.Products
                .FirstOrDefault(prod => prod.ItemId == productId);

            if (product != null)
            {
                cart.AddItem(product, 1);
            }

            return RedirectToAction("Index", new { returnUrl });
        }