Ejemplo n.º 1
0
        public async Task <UsDay> GetUsDataOnDate(DateTime date)
        {
            using (var client = new HttpClient())
            {
                var sourceUrl     = CovidTrackingConfig.UsWithDateString(date);
                var targetContent = await client.GetStringAsync(sourceUrl);

                return(JsonConvert.DeserializeObject <UsDay>(targetContent, serializeSettings));
            }
        }
Ejemplo n.º 2
0
        public async Task <StateDay> GetStateDataByDate(StateCode stateCode, DateTime date)
        {
            using (var client = new HttpClient())
            {
                var sourceUrl     = CovidTrackingConfig.StateWithDateString(stateCode, date);
                var targetContent = await client.GetStringAsync(sourceUrl);

                return(JsonConvert.DeserializeObject <StateDay>(targetContent, serializeSettings));
            }
        }
Ejemplo n.º 3
0
        public async Task <List <StateDay> > GetHistoricStateData(StateCode stateCode = StateCode.None)
        {
            using (var client = new HttpClient())
            {
                var sourceUrl = CovidTrackingConfig.BaseUrlString + CovidTrackingConfig.HistoricStatesString;
                if (stateCode != StateCode.None)
                {
                    sourceUrl = CovidTrackingConfig.HistoricStateString(stateCode);
                }
                var targetContent = await client.GetStringAsync(sourceUrl);

                return(JsonConvert.DeserializeObject <List <StateDay> >(targetContent, serializeSettings));
            }
        }