예제 #1
0
        public ActionResult EditQuantityItem(Cart cart, int productId, int newQuantity)
        {
            cart.EditQuantity(productId, newQuantity);

            Alert.SetAlert(AlertStatus.Info, "Poprawnie wprowadzono zmiany");

            return RedirectToAction("Cart", "Home");
        }
예제 #2
0
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            Cart cart = null;

            if (controllerContext.HttpContext.Session != null)
                cart = (Cart)controllerContext.HttpContext.Session[sessionKey];

            if (cart == null)
            {
                cart = new Cart();

                if (controllerContext.HttpContext.Session != null)
                    controllerContext.HttpContext.Session[sessionKey] = cart;
            }

            return cart;
        }
예제 #3
0
        public ActionResult AddToCart(Cart cart, int productId, int quantity)
        {
            var itemQuantity = _catalogsHelper.GetQuantityItemById(productId);

            if (itemQuantity != 0)
            {
                var item = _catalogsHelper.GetItemById(productId);
                cart.AddItem(item, quantity);

                Alert.SetAlert(AlertStatus.Succes, "Poprawnie dodano przedmiot do koszyka!");

                return RedirectToAction("ItemDescription", new { productId = productId });
            }
            else
            {
                Alert.SetAlert(AlertStatus.Danger, "Brak dostępnego towaru w sklepie!");
                return RedirectToAction("ItemDescription", new { productId = productId });
            }
        }
예제 #4
0
        public ActionResult OrderDetails(Cart cart)
        {
            var client = Session["Client"] as AccountModel;

            Alert.SetAlert(AlertStatus.Warning, "Przy każdej zmianie opcji dostawy należy kliknąć w przycisk Przelicz!");
            return View(_orderHelper.GetOrderModel(cart, client));
        }
예제 #5
0
        public ActionResult RemoveItem(Cart cart, string returnUrl, int productId)
        {
            var item = _catalogsHelper.GetItemById(productId);
            cart.RemoveItem(item);

            Alert.SetAlert(AlertStatus.Info, "Porawnie usnięto produkt: " + item.Title);

            return Redirect(returnUrl);
        }
예제 #6
0
 public ViewResult Cart(Cart cart)
 {
     return View(cart);
 }