Esempio n. 1
0
        //string path = "https://api.coronatracker.com/v2/analytics/country";
        public static async Task <CovidData> GetProductAsync(string path)
        {
            HttpClient          client   = new HttpClient();
            CovidData           covid    = null;
            HttpResponseMessage response = await client.GetAsync(path);

            if (response.IsSuccessStatusCode)
            {
                covid = await response.Content.ReadAsAsync <CovidData>();

                var formatters = new List <MediaTypeFormatter>()
                {
                    new JsonMediaTypeFormatter()
                };
                ;
            }

            return(covid);
        }
Esempio n. 2
0
 public static void ShowProduct(CovidData covid)
 {
     Console.WriteLine($"Country: {covid.country}");
 }