public CountryData() { var countries = new List<Country> { new Country(){Name="China"}, new Country(){Name="USA"}, new Country(){Name="Japan"}, new Country(){Name="South Korea"}, new Country(){Name="Malaysia"}, new Country(){Name="Thailand"}, new Country(){Name="United Kingdom"}, new Country(){Name="Sweden"}, new Country(){Name="Spain"}, new Country(){Name="Germany"}, }; using (FindABookContext context = new FindABookContext()) { countries.ForEach(s => context.Countries.Add(s)); context.SaveChanges(); } }
public PhilippinesData() { Country philippines = new Country(){Name ="Philippines", Provinces = new List<Province>(){ new Province(){Name="Zamboanga del Sur", Cities= new List<City>() {new City(){Name="Zamboanga City"}, new City(){Name="Pagadian"}}}, new Province(){Name="Zamboanga del Norte", Cities = new List<City>() {new City(){Name="Dipolog"},new City(){Name="Dapitan"}}}, new Province(){Name="Zamboanga Sibugay",Cities = new List<City>() {new City(){Name="Ipil"}}} } }; using (FindABookContext db = new FindABookContext()) { db.Countries.Add(philippines); db.SaveChanges(); } }