コード例 #1
0
//---------------------------------------------------------------------------------

        public IActionResult Remove(int pkmnID)
        {
            PokemonModel matchingPkmn = _context.pokemon.FirstOrDefault(p => p.id == pkmnID);

            if (matchingPkmn != null)
            {
                _context.Remove(matchingPkmn);
                _context.SaveChanges();
                return(RedirectToAction("Index"));
            }
            else
            {
                return(Content("No Pokemon with that ID"));
            }
        }