internal void UpdateCountries(bool[] SelectedCountries, IEnumerable <Country> countries) { init(); //reset the lists since SelectedCategories will be used to fill them in this.SelectedCountries = SelectedCountries; foreach (Country tempCountry in countries) { AllCountries.Add(new CountryViewModel(tempCountry)); if (SelectedCountries[AllCountries.Count - 1]) { Countries.Add(new CountryViewModel(tempCountry, false)); } } }
public PlayerViewModel(Player player, IEnumerable <Country> countries) : this(player, true) { this.SelectedCountries = new bool[countries.Count()]; foreach (Country tempCountry in countries) { AllCountries.Add(new CountryViewModel(tempCountry)); bool tempBool = false; foreach (CountryPlayer tempCountryPlayer in player.CountryPlayers) { if (tempCountryPlayer.CountryId == tempCountry.CountryId) { tempBool = true; } } SelectedCountries[AllCountries.Count - 1] = tempBool; } }
public static void AddCountry(Country c) { AllCountries.Add(c); AppDb.Countries.Add(c); AppDb.SaveChanges(); }