public async Task <IActionResult> OnGet(int productId)
        {
            Reservation         = new Reservation();
            Reservation.Product = await _whiskeys.GetById(productId);

            return(Page());
        }
Esempio n. 2
0
        public async Task <IActionResult> OnGet(int productId)
        {
            Whiskey = await _whiskeys.GetById(productId);

            if (Whiskey == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            return(Page());
        }
        public async Task <IActionResult> OnGet(int whiskeyId)
        {
            Product = await _whiskeysDb.GetById(whiskeyId);

            if (Product == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            return(Page());
        }
        public async Task <IActionResult> OnPost()
        {
            if (ModelState.IsValid)
            {
                Reservation.Product = new Whiskey(await _whiskeys.GetById(productAddedID));
                TempData["Message"] = "Created a new reservation.";
                await _reservationsDb.Update(Reservation);

                await _reservationsDb.Commit();

                return(RedirectToPage("./Details",
                                      new { reservationId = Reservation.Id }));
            }
            //TODO: Repopulate dropdown list values.
            return(Page());
        }