Esempio n. 1
0
        public async Task <Country> AddCountry(Country country)
        {
            var cntry = _dbContext.countries.Add(country);
            await _dbContext.SaveChangesAsync();

            return(cntry.Entity);
        }
Esempio n. 2
0
        public async Task <Faith> AddFaith(Faith faith)
        {
            var ft = _dbContext.faiths.Add(faith);
            await _dbContext.SaveChangesAsync();

            return(ft.Entity);
        }
Esempio n. 3
0
        public async Task <Polity> AddPolity(Polity polity)
        {
            var pt = _dbContext.polities.Add(polity);
            await _dbContext.SaveChangesAsync();

            return(pt.Entity);
        }
Esempio n. 4
0
        private static async Task SeedCountryDataAsync(CountryDataContext dbContext)
        {
            await dbContext.AddAsync(new Country
            {
                Area             = 1,
                Capital          = "Country capital",
                Continent        = "Country continent",
                CountryLanguages = new List <CountryLanguage>
                {
                    new CountryLanguage
                    {
                        Language = new Language
                        {
                            Code = "Language code"
                        }
                    }
                },
                Currency = new Currency
                {
                    Code = CurrencyCode,
                    Name = CurrencyName
                },
                Fips           = "Country fips",
                Iso            = "Country ISO",
                Iso3           = "Country ISO3",
                IsoNumeric     = 1,
                Name           = CountryName,
                PhonePrefix    = "Country phone prefix",
                Population     = 1000,
                PostCodeFormat = "Country post code format",
                PostCodeRegex  = "Country post code regex",
                TopLevelDomain = "Country top level domain",
                States         = new List <State>
                {
                    new State
                    {
                        Code      = "State code",
                        Name      = "State name",
                        Provinces = new List <Province>
                        {
                            new Province
                            {
                                Code        = "Province code",
                                Name        = "Province name",
                                Communities = new List <Community>
                                {
                                    new Community
                                    {
                                        Code   = "Community code",
                                        Name   = "Community name",
                                        Places = new List <Place>
                                        {
                                            new Place
                                            {
                                                Name     = "Place name",
                                                LatLong  = "Place lat long",
                                                PostCode = "Place post code"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });

            await dbContext.SaveChangesAsync();
        }
Esempio n. 5
0
 public async Task Create(Settlement settlement)
 {
     db.Settlements.Add(settlement);
     await db.SaveChangesAsync();
 }