/// <summary> /// Permanently delete the current gallery from the data store, including all related records. This action cannot /// be undone. /// </summary> public void Delete() { //Factory.GetDataProvider().Gallery_Delete(this); OnBeforeDeleteGallery(); // Cascade delete relationships should take care of any related records not deleted in OnBeforeDeleteGallery. using (var repo = new GalleryRepository()) { var galleryDto = repo.Find(GalleryId); if (galleryDto != null) { // Delete gallery. Cascade delete rules in DB will delete related records. repo.Delete(galleryDto); repo.Save(); } } Factory.ClearAllCaches(); }
/***************** * DELETE */ public IActionResult Delete(int galleryId) { galleryRepository.Delete(galleryId); return(Redirect("~/")); }