Exemple #1
0
 public static void AddToDbCountry(CountryDBContext _db, Country country, Region region, City city)
 {
     country.RegionId = _db.Regions.FirstOrDefault(r => r.Name == region.Name).Id;
     country.CityId   = _db.Cities.FirstOrDefault(s => s.Name == city.Name).Id;
     _db.Countries.Add(country);
     _db.SaveChanges();
 }
Exemple #2
0
 public static void AddToDbRegion(CountryDBContext _db, Region region)
 {
     _db.Regions.Add(region);
     _db.SaveChanges();
 }
Exemple #3
0
 public static void AddToDbCity(CountryDBContext _db, City city)
 {
     _db.Cities.Add(city);
     _db.SaveChanges();
 }