public IActionResult DeleteConfirmed(int id) { var genre = _genreRepo.Find(g => g.Id == id).FirstOrDefault(); // Null check ??? _genreRepo.Delete(genre); _genreRepo.Save(); return(RedirectToAction(nameof(Index))); }
public ActionResult <GenreEntity> DeleteGenreEntity(int id) { var toRemove = _repository.GetSingle(id); if (toRemove == null) { return(NotFound()); } _repository.Delete(id); if (!_repository.Save()) { throw new Exception("Failed on save"); } return(toRemove); }