public static ShoppingCartLogic GetCart(HttpContextBase context) { var cart = new ShoppingCartLogic(); cart.ShoppingCartId = cart.GetCartId(context); return(cart); }
public ActionResult RemoveFromCart(int id) { var cart = ShoppingCartLogic.GetCart(this.HttpContext); var shoppingCart = new ShoppingCartLogic(); int productId = shoppingCart.GetCartItemProductId(id); var productService = new ProductLogic(); Product productToRemove = productService.FindProduct(productId); int itemCount = cart.RemoveFromCart(id); var removeViewModel = new ShoppingCartRemoveVM { Message = Server.HtmlEncode(productToRemove.Name) + " has been removed from your shopping cart.", CartCount = cart.GetCount(), CartSubTotal = cart.GetSubtotal(), CartSalesTax = cart.GetSalesTax(), CartTotal = cart.GetTotal(), ItemCount = itemCount, DeleteId = id, }; return Json(removeViewModel); }
public static ShoppingCartLogic GetCart(HttpContextBase context) { var cart = new ShoppingCartLogic(); cart.ShoppingCartId = cart.GetCartId(context); return cart; }