Example #1
0
        public ActionResult JoinCountryUnion(int idCountry, string nameUnion, bool status)
        {
            Country      country = mappingController.settingsData.catalog.countryList.Find(item => item.ID == idCountry);
            CountryUnion union   = mappingController.settingsData.catalog.countryUnionList.Find(item => item.Name == nameUnion);

            if ((country != null) & (union != null))
            {
                country.Load();
                union.Load();

                if (status)
                {
                    if (country.UnionList.Find(item => item.ID == union.ID) == null)
                    {
                        country.UnionList.AddElement(country, union);
                    }
                }
                else
                {
                    if (country.UnionList.Find(item => item.ID == union.ID) != null)
                    {
                        country.UnionList.RemoveElement(country, union);
                    }
                }

                country.Load();
                union.Load();
            }

            return(Json(""));
        }
Example #2
0
        public ActionResult DeleteCountryUnion(int id)
        {
            CountryUnion union = mappingController.settingsData.catalog.countryUnionList.Find(item => item.ID == id);

            if (union != null)
            {
                union.Delete();
            }
            return(Json(""));
        }
Example #3
0
        public ActionResult SaveCountryUnion(int id, string Name, string ShortName, string Note)
        {
            CountryUnion union = mappingController.settingsData.catalog.countryUnionList.Find(item => item.ID == id);

            if (union == null)
            {
                union = mappingController.settingsData.catalog.countryUnionList.Create();
            }

            union.Name      = Name;
            union.ShortName = ShortName;
            union.Note      = Note;
            union.Save();

            return(Json(""));
        }