public IActionResult DeleteById(int id) { // first retrive the data Author authorToDelete = _authourRepo.GetAuthorById(id); //then delete the data from the database _authourRepo.DeleteAuthorById(id); // deleting the user file FileHandling fileHandling = new FileHandling(_hostEnvironment); fileHandling.deleteFile(authorToDelete.image_path, "authors"); return(RedirectToAction("Table")); }
public IActionResult DeleteById(int id) { // first retrive the data Book bookToDelete = _bookrepo.GetById(id); //then delete the data from the database _bookrepo.DeleteBookById(id); // deleting the user file FileHandling fileHandling = new FileHandling(_webHostEnvironment); fileHandling.deleteFile(bookToDelete.image_path, "books"); return(RedirectToAction("Table")); }