Exemple #1
0
        //Get: /Add Form: AirLine City Information/
        public ActionResult Create()
        {
            var AirLineCityModel = new AirLineCityModel()
            {
                AirlineCityTypList = ser.GetAirlineCityTypeList(),
                CountryList        = ser.GetAllCountriesList()
            };

            return(View(AirLineCityModel));
        }
Exemple #2
0
        public void AddAirLineCityInfo(AirLineCityModel model)
        {
            EntityModel   ent       = new EntityModel();
            AirlineCities datamodel = new AirlineCities
            {
                CityName          = model.CityName,
                CityCode          = model.CityCode,
                AirlineCityTypeId = model.AirlineCityTypId,
                CountryId         = model.CountryId
            };

            ent.AddToAirlineCities(datamodel);
            ent.SaveChanges();
        }
Exemple #3
0
        public ActionResult Edit(Int32 id)
        {
            var model            = ser.GetAirLineCityinfoByid(id);
            var AirLineCityModel = new AirLineCityModel()
            {
                CityCode           = model.CityCode,
                AirlineCityTypId   = model.AirlineCityTypeId,
                CityName           = model.CityName,
                CityID             = model.CityID,
                CountryId          = model.CountryId,
                CountryList        = ser.GetAllCountriesList(),
                AirlineCityTypList = ser.GetAirlineCityTypeList()
            };

            return(View(AirLineCityModel));
        }
Exemple #4
0
        public void EditAirLineCityInfo(AirLineCityModel model)
        {
            EntityModel ent = new EntityModel();
            var         obj = ent.AirlineCities.Where(x => x.CityID == model.CityID).FirstOrDefault();

            if (obj != null)
            {
                obj.CityID            = model.CityID;
                obj.CityCode          = model.CityCode;
                obj.CityName          = model.CityName;
                obj.AirlineCityTypeId = model.AirlineCityTypId;
                obj.CountryId         = model.CountryId;
                ent.ApplyCurrentValues(obj.EntityKey.EntitySetName, obj);
                ent.SaveChanges();
            }
        }
Exemple #5
0
 public ActionResult Edit(AirLineCityModel model, Int32 id)
 {
     if (model.CityCode == "")
     {
         ModelState.AddModelError("", "City Code is Required");
     }
     else if (model.CityName == "")
     {
         ModelState.AddModelError("", "City Name is Required");
     }
     else
     {
         model.CityID = id;
         ser.EditAirLineCityInfo(model);
     }
     return(RedirectToAction("Index"));
 }
Exemple #6
0
        public ActionResult Create(AirLineCityModel model)
        {
            bool   check = ser.CheckCityName(model.CityName);
            string Name  = model.CityName;
            string Code  = model.CityCode;

            if (check == true)
            {
                ser.AddAirLineCityInfo(model);
                return(RedirectToAction("Index"));
            }
            else
            {
                model = new AirLineCityModel()
                {
                    AirlineCityTypList = ser.GetAirlineCityTypeList(),
                    CountryList        = ser.GetAllCountriesList()
                }
            };
            model.CityName    = Name;
            model.CityCode    = Code;
            TempData["Error"] = "City Already Exists";
            return(View(model));
        }