async Task OnAddedToCart(string productId) { var product = _products?.FirstOrDefault(p => p.Id == productId); if (product is null) { return; } if (await ShoppingCartService.AddOrUpdateItemAsync(1, product)) { _products = await InventoryService.GetAllProductsAsync(); _cartItems = await ShoppingCartService.GetAllItemsAsync(); await ToastService.ShowToastAsync( "Added to cart", $"The '{product.Name}' for {product.UnitPrice:C2} was added to your cart..."); await Observer.NotifyStateChangedAsync(); StateHasChanged(); } }