Example #1
0
        public IEnumerable <EsAirport> GetAllAirports()
        {
            var allCountries = GetAllCountries();

            return(csvReader.GetAirports(configuration.GetSection("Path").GetSection("airport").Value).Select(a =>
                                                                                                              new EsAirport
            {
                id = a.id,
                type = a.type,
                name = a.name,
                coordinates = string.IsNullOrEmpty(a.lat) || string.IsNullOrEmpty(a.lng) ? null : new Nest.GeoCoordinate(Convert.ToDouble(a.lat.Replace(".", ",")), Convert.ToDouble(a.lng.Replace(".", ","))),
                elavation = string.IsNullOrEmpty(a.elavation) ? (double?)null : Convert.ToDouble(a.elavation.Replace(".", ",")),
                continent = a.continent,
                country = allCountries.FirstOrDefault(c => c.iso_code.Equals(a.country)),
                region = a.region,
                municipality = a.municipality,
                gps_code = a.gps_code,
                iata_code = a.iata_code,
                local_code = a.local_code
            }));
        }