public async Task <IActionResult> Create([Bind("ID,DataRep,day,month,year,cases,deaths,countriesAndTerritories,geoId,countryterritoryCode,popData2018,ContinentExp")] Dataset dataset) { if (ModelState.IsValid) { _context.Add(dataset); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(dataset)); }
public static void Insert(Entity entity) { if (entity.Id != 0) { Update(entity); return; } using (var context = new CovidContext()) { context.Add(entity); context.SaveChanges(); } }