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)); }
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)); }
protected CurrentWeatherInTownModel SignResult(CurrentWeatherInTownModel model) { model.Origin = ApiUrl; return(model); }