public async Task <IActionResult> OnPostAddToCartAsync(string productId) { //if (!User.Identity.IsAuthenticated) // return RedirectToPage("./Account/Login", new { area = "Identity" }); var product = await catalogueApi.GetCatalogue(productId); var userName = "******"; var basket = await basketApi.GetBasket(userName); basket.Items.Add(new BasketItemModel { ProductId = productId, ProductName = product.Name, Price = product.Price, Quantity = 1, Color = "Black" }); var basketUpdated = await basketApi.UpdateBasket(basket); return(RedirectToPage("Cart")); }
public async Task<IActionResult> OnGetAsync() { Cart = await _basketApi.GetBasket("test"); return Page(); }
public async Task <IActionResult> OnGetAsync() { Cart = await basketApi.GetBasket("swn").ConfigureAwait(false); return(Page()); }
public async Task<IActionResult> OnGetAsync() { var userName = "******"; Cart = await _basketApi.GetBasket(userName); return Page(); }
public async Task <IActionResult> OnGetAsync() { Cart = await _basketApi.GetBasket("bajinder"); return(Page()); }
public async Task <IActionResult> OnGetAsync() { Cart = await basketApi.GetBasket("james"); return(Page()); }
public async Task <IActionResult> OnGetAsync() { Cart = await _basketApi.GetBasket(username : "******") ?? new BasketModel(); return(Page()); }