public async Task <IActionResult> OnGetCheckStockAsync()
        {
            Basket = BasketHelper.GetBasket(HttpContext.Session);

            if (Basket.Items.Count == 0)
            {
                IsNotEmpty = false;
                return(Page());
            }
            else
            {
                IsNotEmpty = true;
            }

            Basket = BasketHelper.GetBasket(HttpContext.Session);

            foreach (var item in Basket.Items)
            {
                int stockBalance = await _ds.GetProductStockAsync(item.ProductId);

                if (item.Quantity > stockBalance)
                {
                    int length = item.Quantity - stockBalance;

                    for (int i = 0; i < length; i++)
                    {
                        BasketHelper.ModifyItem(HttpContext.Session, item.ProductId, false, false);
                    }
                    StockStatusOK      = false;
                    StockStatusUpdated = true;
                }
            }

            if (StockStatusOK)
            {
                return(RedirectToPage("/Checkout"));
            }

            Basket   = BasketHelper.GetBasket(HttpContext.Session);
            Products = await _ds.GetProductsAsync();

            MainLayout.ShoppingBasket = Basket;
            return(Page());
        }
 public IActionResult OnGetModifyItem(int pid, bool inc = false, bool delete = false)
 {
     BasketHelper.ModifyItem(HttpContext.Session, pid, inc, delete);
     return(RedirectToPage("/shoppingBasket"));
 }