Esempio n. 1
0
 static void AddNewPokemon(PokemonDbContext context)
 {
     using (var db = new PokemonDbContext())
     {
         db.Add(new Pokemon {
             "Coltron"
         });
         db.SaveChanges();
     }
 }
        public IActionResult Registro(Pokemon p)
        {
            if (ModelState.IsValid)
            {
                _context.Add(p);
                _context.SaveChanges();

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(p));
            }
        }