예제 #1
0
        public async Task <bool> Get()
        {
            bool   isfilecreated = true;
            string path          = @_hostingEnvironment.WebRootPath + "\\InputFile\\Weather.txt";

            //string path = @"D:\\WeatherData\\WeatherData\\WeatherData\\wwwroot\\InputFile\\weather.txt";
            try
            {
                IList <City> cities = _file.ReadFile(path);

                foreach (City c in cities)
                {
                    dynamic res = await _weather.GetWeatherDetailsAsync(c.CityId);

                    isfilecreated = await _file.WriteFile(c, _hostingEnvironment, res);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(isfilecreated);
        }