public IActionResult Delete(string id) { Movies m = db.Movies.Find(id); db.Remove(m); db.SaveChanges(); return(RedirectToAction("Favorites")); }
public IActionResult DeleteMovie(int movie_id) { //find the movie id where you want to delete it EnterMovie movie = _context.Movies.Where(m => m.MovieId == movie_id).FirstOrDefault(); //delete the movie and redirect to the list _context.Remove(movie); _context.SaveChanges(); return(Redirect("/Home/List")); }
public IActionResult Delete(int id) { var movie = _moviesDbContext.Movies.Find(id); if (movie == null) { return(NotFound("No movie found against this Id...")); } else { _moviesDbContext.Remove(movie); _moviesDbContext.SaveChanges(); return(Ok("Movie is deleted succesfully!")); } }