예제 #1
0
 public CityViewModel(CITIES city)
 {
     this.CITYID   = city.CITYID;
     this.CITYNAME = city.CITYNAME;
     GetRegions();
     //DeleteCityCommand = new RelayCommand<CitiesViewModel>(p => DeleteCity(p), (p)=> { return p.CitiesList.Contains(this) && p.SelectedCity!=null; });
     AddRegion    = new RegionViewModel();
     DeleteRegion = new RelayCommand(DeleteReg, () => { return(REGIONS.Contains(SelectedRegion)); });
 }
예제 #2
0
        public void SaveCity(CitiesViewModel p)
        {
            CITIES city = new CITIES();

            city.CITYNAME = this.CITYNAME;
            this.CITYNAME = "";
            DbContext.CITIES.Add(city);
            DbContext.SaveChanges();
            p.CitiesList.Add(new CityViewModel(city));
        }