예제 #1
0
        public async Task <IList <RateItem> > GetRatesList()
        {
            try
            {
                var result = await _httpService.GetAsync(url);

                return(_jsonParser.Parse <List <RateItem> >(result));
            }
            catch (Exception ex)
            {
                throw new Exception("GetRatesList exception", ex);
            }
        }
예제 #2
0
        public async Task <Weather> GetWeatherForCityAsync(string city)
        {
            WebUtility.UrlEncode(city);

            var weatherJson = await _httpService.GetAsync(string.Format(url, city, weatherApiKey));

            var weatherResponce = _jsonParser.Parse <WeatherResponce>(weatherJson);
            var details         = weatherResponce.Weather.First();

            return(new Weather
            {
                Name = weatherResponce.Name,
                Description = details.Description,
                Temperature = weatherResponce.Main.Temp
            });
        }