public List <WeatherService> Get()
        {
            var wServices = WeatherServicesBus.Get().GetServices();
            var wServList = wServices.Select(sv => new WeatherService(sv.Id, sv.Name)).ToList();

            return(wServList);
        }
Exemple #2
0
        public IWeatherInfo Get([FromUri] int cityId_, [FromUri] int serviceId_)
        {
            var service     = WeatherServicesBus.Get().GetWthrServiceItemById(serviceId_);
            var city        = CityServicesBus.Get().GetCityById(cityId_);
            var weatherInfo = service.WeatherService.GetWeather(city);

            weatherInfo.Time = DateTime.Now;
            return(weatherInfo);
        }
        /// <summary>
        /// ”становить сервисы погоды, доступные пользователю
        /// </summary>
        protected void setWeatherServices()
        {
            var opServ = OpenWeatherMap.Get();

            opServ.SetKey("6751ae628280d64a208061753519757f");
            WeatherServicesBus.Get().AddService(1, "Open Weather Map", opServ);

            var yndxServ = YandexWeatherMap.Get();

            yndxServ.SetKey("1149c371-2412-44ae-9b44-33d25dd35216");
            WeatherServicesBus.Get().AddService(2, "Yandex Weather Map", yndxServ);
        }