예제 #1
0
        private static CountryInfoDto[] GetBorderCountryInfos(Alpha2Code[] countryCodes)
        {
            var countryProvider = new Country.CountryProvider();
            var items           = new List <CountryInfoDto>();

            foreach (var countryCode in countryCodes)
            {
                var country = countryProvider.GetCountry(countryCode);

                var countryInfo = new CountryInfoDto
                {
                    CommonName   = country.CommonName,
                    OfficialName = country.OfficialName,
                    CountryCode  = country.Alpha2Code.ToString(),
                    Region       = country.Region.ToString()
                };

                items.Add(countryInfo);
            }

            return(items.ToArray());
        }
예제 #2
0
        private CountryInfoDto[] GetCountryInfos(Country.Alpha2Code[] countryCodes)
        {
            var countryProvider = new Country.CountryProvider();
            var items           = new List <CountryInfoDto>();

            foreach (var countryCode in countryCodes)
            {
                var country = countryProvider.GetCountry(countryCode);

                var countryInfo = new CountryInfoDto
                {
                    CommonName           = country.CommonName,
                    OfficialName         = country.OfficialName,
                    CountryCode          = country.Alpha2Code.ToString(),
                    AlternativeSpellings = country.Translations.Select(o => o.Name).ToArray(),
                    Region = country.Region.ToString()
                };

                items.Add(countryInfo);
            }

            return(items.ToArray());
        }