コード例 #1
0
        public ActionResult Create(AirlineFlighClassViewModel model)
        {
            bool check = _domesticProvider.CheckFlightCode(model.AirlineId, model.FlightClassCode);

            if (check == false)
            {
                try
                {
                    _domesticProvider.AddFlightClass(model);
                    /////// Return to View After Success
                    AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel()
                    {
                        DomesticAirlineList = _domesticProvider.GetDomesticAirlineList(),
                    };
                    TempData["Message"] = "Successfully added";
                    return(RedirectToAction("Index"));
                }
                catch
                {
                    return(RedirectToAction("Index"));
                }
            }
            TempData["Message"] = "Code Already exists";
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult Edit(AirlineFlighClassViewModel model)
        {
            // int airlineId = _domesticProvider.GetAirlineId(model.FlightClassId);
            model.AirlineId = model.HFAirlineId;
            // model.FlightClassId = id;
            bool check = true;

            check = _domesticProvider.CheckFlightCode(model.AirlineId, model.FlightClassCode);



            try
            {
                // TODO: Add update logic here
                _domesticProvider.UpdatFlightClasses(model);
                //  TempData["Message"] = "Successfully updated";
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }


            //TempData["Message"] = "Code Already exists";
            //return RedirectToAction("Index");
        }
コード例 #3
0
        //
        // GET: /DomesticFlightClass/

        public ActionResult Index()
        {
            AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel()
            {
                AirlineFlighClass = _domesticProvider.GetAllFlightClassesList().ToList().AsQueryable(),
            };

            return(View(viewmodel));
        }
コード例 #4
0
        public void UpdatFlightClasses(AirlineFlighClassViewModel modeltosave)
        {
            Air_DomesticFlightClasses comm = ent.Air_DomesticFlightClasses.Where(u => u.DomesticFlightClassId == modeltosave.FlightClassId).FirstOrDefault();

            comm.DomesticFlightClassId = modeltosave.FlightClassId;
            comm.FlightClassCode       = modeltosave.FlightClassCode;
            comm.FlightClassType       = modeltosave.ClassType;
            ent.ApplyCurrentValues(comm.EntityKey.EntitySetName, comm);
            ent.SaveChanges();
            /////
        }
コード例 #5
0
        /////////// only Flight Class For domestic ///////////////

        public void AddDomesticAirlineFlightClass(AirlineFlighClassViewModel model)
        {
            AirlineFlightClasses datamodel = new AirlineFlightClasses
            {
                AirlineId     = model.AirlineId,
                FlightClassId = model.FlightClassId,
            };

            ent.AddToAirlineFlightClasses(datamodel);
            ent.SaveChanges();
        }
コード例 #6
0
        public void AddFlightClass(AirlineFlighClassViewModel model)
        {
            Air_DomesticFlightClasses datamodel = new Air_DomesticFlightClasses
            {
                AirlineId       = model.AirlineId,
                FlightClassCode = model.FlightClassCode,
                FlightClassType = model.ClassType
            };

            ent.AddToAir_DomesticFlightClasses(datamodel);
            ent.SaveChanges();
        }
コード例 #7
0
        //
        // GET: /DomesticFlightClass/Create

        public ActionResult Create()
        {
            AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel()
            {
                DomesticAirlineList = _domesticProvider.GetDomesticAirlineList(),
            };

            if (Request != null && Request.IsAjaxRequest())
            {
                return(PartialView("Create", viewmodel));
            }
            else
            {
                return(View(viewmodel));
            }
        }
コード例 #8
0
 public ActionResult DomesticFlightClass(AirlineFlighClassViewModel model, int[] ChkFlightClassId)
 {
     try
     {
         _domesticProvider.DeleteAirlineFlightClasses(model.AirlineId);
         List <int> ChkFlightClassIdS = new List <int>();
         foreach (int Classid in ChkFlightClassId)
         {
             model.FlightClassId = Classid;
             _domesticProvider.AddDomesticAirlineFlightClass(model);
         }
         // TODO: Add delete logic here
         int id = model.AirlineId;
         TempData["Message"] = "Successfully Updated";
         return(RedirectToAction("DomesticFlightClass", new { id = model.AirlineId }));
     }
     catch
     {
         return(View());
     }
 }
コード例 #9
0
 public ActionResult ViewDomesticFlightClass(AirlineFlighClassViewModel model)
 {
     if (model.AirlineId != 0)
     {
         AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel()
         {
             AirlineId                   = model.AirlineId,
             DomesticAirlineList         = _domesticProvider.GetDomesticAirlineList(),
             AirlineFlighClass           = _domesticProvider.GetFlightClassDomesticAirline(),
             ActiveFlightClassForAirline = _domesticProvider.GetAllActiveFlightClassForAirline(model.AirlineId).ToList()
         };
         return(View("DomesticFlightClass", viewmodel));
     }
     else
     {
         AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel()
         {
             DomesticAirlineList = _domesticProvider.GetDomesticAirlineList(),
         };
         return(View("DomesticFlightClass", viewmodel));
     }
 }
コード例 #10
0
        //
        // GET: /DomesticFlightClass/EditFlightClass/5

        public ActionResult Edit(int id)
        {
            var datamodel = _domesticProvider.GeFlightClassesInfo(id);
            var viewmodel = new AirlineFlighClassViewModel()
            {
                FlightClassId       = id,
                FlightClassCode     = datamodel.FlightClassCode,
                AirlineId           = datamodel.AirlineId,
                HFAirlineId         = datamodel.AirlineId,
                DomesticAirlineList = _domesticProvider.GetDomesticAirlineList(),
                ClassType           = datamodel.FlightClassType,
            };

            if (Request != null && Request.IsAjaxRequest())
            {
                return(PartialView("_Edit", viewmodel));
            }
            else
            {
                return(View(viewmodel));
            }
        }
コード例 #11
0
        public ActionResult DomesticFlightClass(int id)
        {
            if (id != 0)
            {
                AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel()
                {
                    AirlineId                   = id,
                    DomesticAirlineList         = _domesticProvider.GetDomesticAirlineList(),
                    AirlineFlighClass           = _domesticProvider.GetFlightClassDomesticAirline(),
                    ActiveFlightClassForAirline = _domesticProvider.GetAllActiveFlightClassForAirline(id).ToList()
                };

                return(View(viewmodel));
            }
            else
            {
                AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel()
                {
                    DomesticAirlineList = _domesticProvider.GetDomesticAirlineList(),
                };
                return(View(viewmodel));
            }
        }