コード例 #1
0
        public ActionResult Create(BookingExtraParticipant bookingextraparticipant)
        {
            if (ModelState.IsValid)
            {
                db.BookingExtraParticipants.Add(bookingextraparticipant);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.BookingExtraSelectionID = new SelectList(db.BookingExtraSelections, "BookingExtraSelectionID", "Test", bookingextraparticipant.BookingExtraSelectionID);
            return View(bookingextraparticipant);
        }
コード例 #2
0
 public ActionResult Edit(BookingExtraParticipant bookingextraparticipant)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bookingextraparticipant).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.BookingExtraSelectionID = new SelectList(db.BookingExtraSelections, "BookingExtraSelectionID", "Test", bookingextraparticipant.BookingExtraSelectionID);
     return View(bookingextraparticipant);
 }
        public ActionResult CreateBookingExtraParticipant(BookingExtraParticipant bookingExtraParticipant, string submitBookingExtraPart)
        {
            PortugalVillasContext db = new PortugalVillasContext();

            if (ModelState.IsValid)
            {

                GeneralStaticHelperMethods.IsPersonAdultChildOrInfant(bookingExtraParticipant);
                //need to assign the booking ID
                BookingExtraSelection currentSelection = (BookingExtraSelection)Session["CurrentBookingExtraDataGathering"];
                bookingExtraParticipant.BookingExtraSelectionID = currentSelection.BookingExtraSelectionID;

                db.BookingExtraParticipants.Add(bookingExtraParticipant);
                db.SaveChanges();

                //check they're under 18 or whatever then make them an infant, or child if they're the corresponsing age
                //is infant
                //is child

                if (submitBookingExtraPart.Equals("Add this participant and add another"))
                {
                    return RedirectToAction("CreateBookingExtraParticipant");
                }

            }

            return RedirectToAction("DetailGatheringEventChain");

        }