public async Task MonitorCurrentWeather() { AllWeatherData data = await GetCurrentWeather(); await _restService.Post(data, "http://localhost:8080/milestone3/rest/weather/postCurrentWeather"); Console.WriteLine(JsonConvert.SerializeObject(data)); }
public async Task <AllWeatherData> Get(string url) { HttpResponseMessage response = await httpClient.GetAsync(url); String stringResponse = await response.Content.ReadAsStringAsync(); if (response.StatusCode != System.Net.HttpStatusCode.OK) { throw new HttpRequestException(stringResponse); } AllWeatherData allWeatherData = JsonConvert.DeserializeObject <AllWeatherData>(stringResponse); return(allWeatherData); }