Пример #1
0
        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)));
        }
Пример #2
0
        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);
        }