Exemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            Animate = true;
            Product = await _ds.GetProductByIdAsync(ProductId.Value);

            BasketHelper.AddToBasket(HttpContext.Session, ProductId.Value, Product.CalculatedPrice, Number);
            return(RedirectToPage("/Categories", new { CategoryId = CategoryId }));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            Animate = true;
            Product = await _ds.GetProductByIdAsync(ProductId.Value);

            BasketHelper.AddToBasket(HttpContext.Session, ProductId.Value, Product.CalculatedPrice, Number);
            return(RedirectToPage("ProductDetails", new { ProductId = ProductId }));
//            MainLayout.ShoppingBasket = BasketHelper.GetBasket(HttpContext.Session);
//            ViewData["MainLayout"] = MainLayout;
        }
Exemplo n.º 3
0
        public async Task <IActionResult> OnPostAsync()
        {
            var userID = _um.GetUserId(User);
            var q      = await _ds.GetAllOrdersAsync();

            Orders = q.Where(o => o.UserID == userID);

            if (OrderId != 0)
            {
                Order = _ds.GetOrder(OrderId);

                foreach (var item in Order.OrderItems)
                {
                    var prod = await _ds.GetProductByIdAsync(item.ProductId);

                    BasketHelper.AddToBasket(HttpContext.Session, item.ProductId, prod.CalculatedPrice, item.Quantity);
                }
            }
            return(RedirectToPage("/ShoppingBasket"));
        }