예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,Nombre")] Region region)
        {
            if (ModelState.IsValid)
            {
                _context.Add(region);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(region));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,Tipo1")] Tipo tipo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tipo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tipo));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("Id,Nombre,Ataque1,Ataque2,Ataque3,Ataque4,Region,Tipo")] Pokemon pokemon)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pokemon);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Region"] = new SelectList(_context.Region, "Id", "Nombre", pokemon.Region);
            ViewData["Tipo"]   = new SelectList(_context.Tipo, "Id", "Tipo1", pokemon.Tipo);
            return(View(pokemon));
        }