Beispiel #1
0
        public IActionResult AddGuest(CoupleAddNewGuestVM newGuestVM)
        {
            if (!ModelState.IsValid)
            {
                return(View(newGuestVM));
            }

            coupleServices.AddNewGuest(newGuestVM);
            return(RedirectToAction(nameof(GuestList)));
        }
Beispiel #2
0
        public IActionResult AddGuest(CoupleAddNewGuestVM newGuestVM, string saveAdd, string saveCancel)
        {
            if (!ModelState.IsValid)
            {
                return(View(newGuestVM));
            }

            if (!string.IsNullOrEmpty(saveAdd))
            {
                coupleServices.AddNewGuest(newGuestVM);
                return(RedirectToAction(nameof(AddGuest)));
            }
            else if (!string.IsNullOrEmpty(saveCancel))
            {
                coupleServices.AddNewGuest(newGuestVM);
                return(RedirectToAction(nameof(GuestList)));
            }
            return(RedirectToAction(nameof(GuestList)));  //redirect to something went wrong
        }