public async Task <IActionResult> OnPost()
        {
            if (ModelState.IsValid)
            {
                TempData["Message"] = "Created a new reservation.";
                await _whiskeysDb.Update(Product);

                await _whiskeysDb.Commit();

                return(RedirectToPage("Products/Details",
                                      new { whiskeyId = Product.Id }));
            }
            return(Page());
        }
Exemple #2
0
        public async Task <IActionResult> OnPost()
        {
            if (ModelState.IsValid)
            {
                TempData["Message"] = "Created a new whiskey.";
                await _whiskeys.Update(Whiskey);

                await _whiskeys.Commit();

                //BUG: Redirect to details not showing.
                return(RedirectToPage("DetailsWhiskey",
                                      new { productId = Whiskey.Id }));
            }
            //TODO: Repopulate dropdown list values.
            return(Page());
        }