public async Task <IActionResult> SaveCovid(CovidClass covidClass) { await _covidService.SaveCovid(covidClass); IQueryable <CovidClass> covid = _covidService.GetList(); return(Ok(covid)); }
public async Task SaveCovid(CovidClass covid) { await _appDbContext.Covids.AddAsync(covid); await _appDbContext.SaveChangesAsync(); await _context.Clients.All.SendAsync("ReceiveCovidList", GetCovidList()); }
public IActionResult InitializeCovid() { Random rn = new Random(); Enumerable.Range(1, 10).ToList().ForEach(i => { foreach (ECity item in Enum.GetValues(typeof(ECity))) { var newCovid = new CovidClass() { City = item, Count = rn.Next(100, 10000), CovidDate = DateTime.Now.AddDays(i) }; _covidService.SaveCovid(newCovid).Wait(); System.Threading.Thread.Sleep(1000); } }); return(Ok()); }