public Cart GetCart() { Cart cart = (Cart)Session["Cart"]; if (cart == null) { cart = new Cart(); Session["Cart"] = cart; } return cart; }
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { Cart cart = null; if (controllerContext.HttpContext.Session != null) { cart = (Cart)controllerContext.HttpContext.Session[sesionKey]; } if (cart == null) { cart = new Cart(); if (controllerContext.HttpContext.Session != null) { controllerContext.HttpContext.Session[sesionKey] = cart; } } return cart; }
public PartialViewResult Summary(Cart cart) { return PartialView(cart); }