Beispiel #1
0
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var cart = (Cart)controllerContext.HttpContext.Session[Constants.CartKey];
            if (cart == null)
            {
                cart = new Cart();
                controllerContext.HttpContext.Session[Constants.CartKey] = cart;
            }

            return cart;
        }
Beispiel #2
0
        protected override void Initialize(RequestContext requestContext)
        {
            base.Initialize(requestContext);
            var cart = (Cart) ControllerContext.HttpContext.Session[Constants.CartKey];
            if (cart == null)
            {
                cart = new Cart();
                ControllerContext.HttpContext.Session[Constants.CartKey] = cart;
            }

            Cart = cart;
            RefreshCart();
        }