Beispiel #1
0
        public ActionResult Create(int id)
        {
            var model = new SeatSectionCreateViewModel()
            {
                FlightId  = id,
                SeatClass = GetSeatClassDropDown()
            };

            return(View(model));
        }
Beispiel #2
0
        public ActionResult Create(SeatSectionCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                //SeatClass seatClass;

                //Enum.TryParse(model.SeatClass.ToList().Where(m => m.Value == model.SeatClassId.ToString()).FirstOrDefault().Text, out seatClass);
                try
                {
                    db.AddSeatsForFlight(model.FlightId, model.row, model.col, model.SeatClassId);
                }
                catch (Exception e)
                {
                    return(RedirectToAction("Error", new { message = e.Message }));
                }
                return(RedirectToAction("Index", "Flight"));
            }
            model.SeatClass = GetSeatClassDropDown();
            return(View(model));
        }