예제 #1
0
        public static List <Country> GetCountriesByContinentId(string continentCode)
        {
            string urlParameters = "/country?lang=tr&fields=value%2C%20iso_a2&continent_code=" + continentCode;

            var countries = APICall.RunAsync <List <Country> >(url, apiKey, apiHost, urlParameters).GetAwaiter().GetResult();

            return(countries);
        }
예제 #2
0
        public static List <Continent> GetContinents()
        {
            string urlParameters = "/continent?lang=tr&fields=value%2C%20iso_a2";
            var    continents    = APICall.RunAsync <List <Continent> >(url, apiKey, apiHost, urlParameters).GetAwaiter().GetResult();

            if (continents != null)
            {
                for (int i = 0; i < continents.Count; i++)
                {
                    continents[i].Id = i + 1;
                }
            }

            return(continents);
        }
예제 #3
0
        public static List <City> GetCitiesByCountryId(string countryCode)
        {
            string urlParameters = "";

            if (countryCode.Equals("tr"))
            {
                urlParameters = "/state?lang=tr&iso_a2=" + countryCode;
            }
            else
            {
                urlParameters = "/city?lang=tr&iso_a2=" + countryCode;
            }

            var cities = APICall.RunAsync <List <City> >(url, apiKey, apiHost, urlParameters).GetAwaiter().GetResult();

            if (cities == null)
            {
                urlParameters = "/city?lang=tr&iso_a2=" + countryCode;
                cities        = APICall.RunAsync <List <City> >(url, apiKey, apiHost, urlParameters).GetAwaiter().GetResult();
            }

            return(cities);
        }