public async Task <WeatherResponseApi> GetWeatherFromCity(string cityName) { try { using (HttpClient client = new HttpClient()) { HttpResponseMessage response = await client.GetAsync($"http://api.openweathermap.org/data/2.5/weather?q={cityName}&appid={_weatherApiKey}&units=metric&lang=vi"); string apiResponse = await response.Content.ReadAsStringAsync(); WeatherResponseApi data = JsonConvert.DeserializeObject <WeatherResponseApi>(apiResponse); return(data); }; } catch (Exception ex) { return(null); } }
private void SaveHistory(WeatherResponseApi obj) { }