private void btnDelete_Click(object sender, EventArgs e) { BookRepo repo = new BookRepo(); //repo.Delete(10); repo.DeleteBookById(21); }
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")); }