예제 #1
0
        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"));
        }
예제 #2
0
 public async Task<IActionResult> OnGetAsync()
 {
     Cart = await _basketApi.GetBasket("test");
     return Page();
 }
예제 #3
0
        public async Task <IActionResult> OnGetAsync()
        {
            Cart = await basketApi.GetBasket("swn").ConfigureAwait(false);

            return(Page());
        }
예제 #4
0
 public async Task<IActionResult> OnGetAsync()
 {
     var userName = "******";
     Cart = await _basketApi.GetBasket(userName);
     return Page();
 }
예제 #5
0
        public async Task <IActionResult> OnGetAsync()
        {
            Cart = await _basketApi.GetBasket("bajinder");

            return(Page());
        }
예제 #6
0
        public async Task <IActionResult> OnGetAsync()
        {
            Cart = await basketApi.GetBasket("james");

            return(Page());
        }
예제 #7
0
        public async Task <IActionResult> OnGetAsync()
        {
            Cart = await _basketApi.GetBasket(username : "******") ?? new BasketModel();

            return(Page());
        }