public IActionResult DeletePlanet(int id)
        {
            var planet = context.Planets.Find(id);

            if (planet == null)
            {
                return(NotFound());
            }

            context.Planets.Remove(planet);
            context.SaveChanges();

            return(NoContent());
        }
예제 #2
0
    public IActionResult DeleteAsteroid(int id)
    {
        var asteroid = context.Asteroids.Find(id);

        if (asteroid == null)
        {
            return(NotFound());
        }

        //Asteroid verwijderen
        context.Asteroids.Remove(asteroid);
        context.SaveChanges();
        //Standaard response 204 bij een gelukte delete
        return(NoContent());
    }