public async Task <List <Region> > GetRegions()
        {
            ListRegions = new List <Region>();

            await request.GetRequest("https://covid-19-statistics.p.rapidapi.com/regions");

            using (var response = await client.SendAsync(request.request))
            {
                response.EnsureSuccessStatusCode();
                var bodyData = await response.Content.ReadAsStringAsync();

                DatosRegion region = JsonConvert.DeserializeObject <DatosRegion>(bodyData);
                ListRegions = region.data.OrderBy(r => r.name).ToList();
            }
            return(ListRegions);
        }
Exemple #2
0
 public DatosReport()
 {
     request     = new Request();
     datosRegion = new DatosRegion();
     client      = new HttpClient();
 }