Beispiel #1
0
        public async Task <ActionResult> Delete(int id)
        {
            var exits = await _context.People.AnyAsync(x => x.Id == id);

            if (!exits)
            {
                return(NotFound());
            }
            _context.Remove(new Person()
            {
                Id = id
            });
            await _context.SaveChangesAsync();

            return(NoContent());
        }
        public async Task <ActionResult <Movie> > DeleteMovie(int id)
        {
            //var movie = await _context.Movies.FindAsync(id);
            var exists = await _context.Movies.AnyAsync(x => x.Id == id);

            if (!exists)
            {
                return(NotFound());
            }

            _context.Remove(new Movie()
            {
                Id = id
            });
            await _context.SaveChangesAsync();

            return(NoContent());
        }