Example #1
0
 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));
         }
     }
 }
Example #2
0
 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;
     }
 }
Example #3
0
 public static void AddCountry(Country c)
 {
     AllCountries.Add(c);
     AppDb.Countries.Add(c);
     AppDb.SaveChanges();
 }