Exemplo n.º 1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Country,TotalCases,NewCases,TotalDeaths,TotalRecovered,ActiveCases,SeriousCritical")] PeopleWithCovid peopleWithCovid)
        {
            if (id != peopleWithCovid.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(peopleWithCovid);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PeopleWithCovidExists(peopleWithCovid.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(peopleWithCovid));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Country,TotalCases,NewCases,TotalDeaths,TotalRecovered,ActiveCases,SeriousCritical")] PeopleWithCovid peopleWithCovid)
        {
            peopleWithCovid.Id = Guid.NewGuid();
            _context.Add(peopleWithCovid);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }