public IActionResult OnPost(int WhiskeyId) { Order.CustomerName = User.FindFirst("fullname").Value; Order.Whiskey = whiskeyData.Getall().FirstOrDefault(a => a.Id == WhiskeyId); Whiskey = whiskeyData.GetById(WhiskeyId); NewSupply = Whiskey.Supply - Order.AmountBottles; whiskeyData.AddOrder(Order); whiskeyData.Update(Order.Whiskey, NewSupply); whiskeyData.Commit(); TempData["Message"] = "Your order is placed!"; return(RedirectToPage("./Index")); }