public CitiesResponseDTO GetCities() { ICityWeatherInfoRepository weatherRepository = new CityWeatherInfoRepository(); IEnumerable <Domain.Models.CityWeatherInfo> weatherData; try { weatherData = weatherRepository.GetAll(); } catch (CityWeatherInfoRepositoryException e) { throw new WebFaultException <ErrorDTO>(new ErrorDTO(e.ToString()), HttpStatusCode.InternalServerError); } var response = new CitiesResponseDTO(); foreach (var wi in weatherData) { response.Cities.Add(new CityWeatherInfoDTO { CityId = wi.CityId, Name = wi.Name, TempDay = wi.TempDay, TempNight = wi.TempNight, WeatherComment = wi.WeatherComment }); } return(response); }
static void Main(string[] args) { IWeatherProviderService weatherProvider = new YandexService(new RequestProvider()); ICityWeatherInfoRepository infoRepository = new CityWeatherInfoRepository(); var app = new Application(weatherProvider, infoRepository); Console.ReadLine(); // Нет особого смысла вызывать здесь Dispose app.Dispose(); }