示例#1
0
 public IActionResult Post([FromBody] PokemonRace race)
 {
     if (race != null)
     {
         ctx.Races.Add(race);
         ctx.SaveChanges();
         return(Created("", race));
     }
     else
     {
         return(NotFound());
     }
 }
示例#2
0
        public IActionResult Delete(int id)
        {
            PokemonRace race = ctx.Races.Find(id);

            if (race != null)
            {
                ctx.Races.Remove(race);
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }