コード例 #1
0
ファイル: EcommerceController.cs プロジェクト: ptgc/GAdemo
        public ActionResult Checkout()
        {
            var model = new EcommerceViewModel {
                Basket = BasketController.GetBasket()
            };

            return(View(model));
        }
コード例 #2
0
ファイル: EcommerceController.cs プロジェクト: ptgc/GAdemo
        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
ファイル: EcommerceController.cs プロジェクト: ptgc/GAdemo
        public ActionResult AddToBasket()
        {
            var cachedBasket = BasketController.GetBasket();

            var model = new EcommerceViewModel
            {
                Basket = cachedBasket
            };

            return(View("~/Views/Ecommerce/Product.cshtml", model));
        }
コード例 #4
0
ファイル: EcommerceController.cs プロジェクト: ptgc/GAdemo
        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));
        }