public IActionResult DeleteConfirmed(int id) { try { _category.Delete(id); _book.DeleteBookWithCategoryById(id); return(RedirectToAction(nameof(Index))); } catch (DbUpdateException) { ModelState.AddModelError("", "Unable to save changes. " + "Try again, and if the problem persists, " + "see your system administrator."); return(RedirectToAction(nameof(Delete))); } }