Exemplo n.º 1
0
        protected override async Task <CurrentWeatherInTownModel> Convert(string json)
        {
            dynamic smth        = JsonConvert.DeserializeObject(json);
            string  townName    = smth.name;
            decimal temperature = smth.main.temp;
            decimal pressure    = smth.main.pressure;
            decimal humidity    = smth.main.humidity;

            var model = new CurrentWeatherInTownModel
            {
                TownName    = townName,
                Temperature = temperature,
                Pressure    = pressure,
                Humidity    = humidity
            };

            return(SignResult(model));
        }
Exemplo n.º 2
0
        protected override async Task <CurrentWeatherInTownModel> Convert(string json)
        {
            dynamic smth        = JsonConvert.DeserializeObject(json);
            string  townName    = smth.data[0].city_name;
            string  pressure    = smth.data[0].pres;
            string  temperature = smth.data[0].temp;
            string  humidity    = smth.data[0].rh;

            var model = new CurrentWeatherInTownModel
            {
                TownName    = townName,
                Temperature = decimal.Parse(temperature),
                Pressure    = decimal.Parse(pressure),
                Humidity    = decimal.Parse(humidity)
            };

            return(SignResult(model));
        }
Exemplo n.º 3
0
 protected CurrentWeatherInTownModel SignResult(CurrentWeatherInTownModel model)
 {
     model.Origin = ApiUrl;
     return(model);
 }