public async Task <RedirectToActionResult> AddToCartAsync(GameViewModel gameView, int gameId) { var selectedGame = await GetGameByIdAsync(gameId); if (selectedGame != null) { await _cart.AddToCartAsync(selectedGame, gameView.Amount); } return(RedirectToAction("Index")); }
private async Task AddToCartAsync() { if (IsInCart) { return; } var orderItem = new OrderItemParams() { ProductId = ProductId, Product = Product }; await CartService.AddToCartAsync(orderItem); StateHasChanged(); NavigationManager.NavigateTo("/cart"); }