Beispiel #1
0
        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));
        }
Beispiel #2
0
        public static void Insert(Entity entity)
        {
            if (entity.Id != 0)
            {
                Update(entity);
                return;
            }

            using (var context = new CovidContext())
            {
                context.Add(entity);
                context.SaveChanges();
            }
        }