public IActionResult GetPurchaseWindow(string gameId) { Game game = gamesTable.GetGameByUrl(gameId) !; User user = usersTable.GetUserByEmail(User.Identity.Name !) !; // add game to cart to have access to it later cartTable.AddItem(user.Email, gameId); var price = game.GameInfo.Price; var discount = price * (decimal)game.GameInfo.Discount; var resultPrice = price - discount; var moneyLeft = user.Balance - resultPrice; if (moneyLeft < 0) { return(PartialView("_AddFundsPartial")); } return(PartialView( "_BuyUsingWalletPartial", new PurchaseViewModel { ActualPrice = price, DiscountAmount = discount, ResultPrice = resultPrice, MoneyLeft = moneyLeft } )); }