public IActionResult Get() { IAsyncEnumerable <TownCovidInfo> results; using (var context = new CovidContext()) { results = context.TownCovidInformation.AsAsyncEnumerable(); } return(Ok(results)); }
public async Task RunJob() { var http = new HttpClient(); using var response = await http.GetAsync("https://data.ct.gov/resource/28fr-iqnx.json"); var db = new CovidContext(); var content = await response.Content.ReadAsStreamAsync(); var c = await response.Content.ReadAsStringAsync(); var results = await JsonSerializer.DeserializeAsync <List <TownCovidInfo> >(content); for (int i = 0; i < 169; i++) { db.Add(results[i]); } db.SaveChanges(); }