Esempio n. 1
0
        private static void SeedRegion(AddressFormDbContext context, Guid id, string countryId, string abbreviation, string name)
        {
            var region = context.Regions.SingleOrDefault(r => r.Id == id);
            if (region != null)
            {
                return;
            }

            region = new Region
            {
                Id = id,
                CountryId = countryId,
                Abbreviation = abbreviation,
                Name = name
            };

            context.Regions.Add(region);
            context.SaveChanges();
        }
Esempio n. 2
0
        private static void SeedCountry(AddressFormDbContext context, string id, string alpha3Code, string numericCode, string iso3166_2Code, string name)
        {
            var country = context.Countries.SingleOrDefault(c => c.Id == id);
            if (country != null)
            {
                return;
            }

            country = new Country
            {
                Id = id,
                Alpha3Code = alpha3Code,
                NumericCode = numericCode,
                Iso3166_2Code = iso3166_2Code,
                Name = name
            };

            context.Countries.Add(country);
            context.SaveChanges();
        }