This commit is contained in:
@@ -32,9 +32,6 @@ public partial class ProductView : ComponentBase
|
||||
|
||||
protected Author? CurrentAuthor { get; private set; }
|
||||
|
||||
private static Func<Services.ShoppingCart.Models.Cart, long, int> getCartItemQuantity = (shoppingCart, productPriceId) =>
|
||||
shoppingCart.Items.FirstOrDefault(p => p.Price!.Id == productPriceId)?.Quantity ?? 1;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
try
|
||||
@@ -97,7 +94,7 @@ public partial class ProductView : ComponentBase
|
||||
{
|
||||
CartService.UpdateQuantity(CurrentPrice!.Id, 1);
|
||||
|
||||
Quantity = getCartItemQuantity(ShoppingCart, CurrentPrice.Id);
|
||||
Quantity = CartService.GetCartItemQuantity(ShoppingCart, CurrentPrice.Id);
|
||||
|
||||
await CartService.SaveCartToStorageAsync();
|
||||
}
|
||||
@@ -108,7 +105,7 @@ public partial class ProductView : ComponentBase
|
||||
{
|
||||
CartService.UpdateQuantity(CurrentPrice!.Id, -1);
|
||||
|
||||
Quantity = getCartItemQuantity(ShoppingCart, CurrentPrice.Id);
|
||||
Quantity = CartService.GetCartItemQuantity(ShoppingCart, CurrentPrice.Id);
|
||||
|
||||
await CartService.SaveCartToStorageAsync();
|
||||
}
|
||||
@@ -131,7 +128,7 @@ public partial class ProductView : ComponentBase
|
||||
|
||||
CartService.AddItem(CurrentPrice, CurrentProduct, CurrentAuthor!);
|
||||
|
||||
Quantity = getCartItemQuantity(ShoppingCart, CurrentPrice.Id);
|
||||
Quantity = CartService.GetCartItemQuantity(ShoppingCart, CurrentPrice.Id);
|
||||
|
||||
await CartService.SaveCartToStorageAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user