示例#1
0
        public ActionResult Checkout()
        {
            var model = new EcommerceViewModel {
                Basket = BasketController.GetBasket()
            };

            return(View(model));
        }
示例#2
0
        public ActionResult Orderconfirmation()
        {
            var model = new EcommerceViewModel {
                Basket = BasketController.GetBasket()
            };

            model.Purchase = Mockdata.Mockdata.GetGApurchase(model.Basket);
            System.Web.HttpContext.Current.Cache.Remove("GAbasket");
            return(View(model));
        }
示例#3
0
        public ActionResult AddToBasket()
        {
            var cachedBasket = BasketController.GetBasket();

            var model = new EcommerceViewModel
            {
                Basket = cachedBasket
            };

            return(View("~/Views/Ecommerce/Product.cshtml", model));
        }
示例#4
0
        public ActionResult AddToBasket(FormCollection formCollection)
        {
            var productId    = formCollection.Get("ProductId");
            var cachedBasket = BasketController.GetBasket();
            var basket       = cachedBasket ?? new GAbasket()
            {
                BasketId = Utils.Utils.RandomString(16), Items = new List <GAproduct>()
            };
            var addedProduct = Mockdata.Mockdata.GetMockProduct(Convert.ToInt32(productId));

            basket.Items.Add(addedProduct);
            var cachedCart = System.Web.HttpContext.Current.Cache.Add("GAbasket", basket, null, DateTime.Now.AddMinutes(30), Cache.NoSlidingExpiration, CacheItemPriority.High, null);

            var model = new EcommerceViewModel
            {
                Basket         = basket,
                AddedGAproduct = addedProduct,
                Product        = addedProduct,
                Message        = addedProduct.Name + " lagt til i handlekurv."
            };

            return(View("~/Views/Ecommerce/Product.cshtml", model));
        }