public static void DeleteThumbnail(ImageViewModel target, DataOperationUnit dataOpUnit = null) { Contract.Requires(target != null); Contract.Requires(target.Thumbnail != null); var deleting = target.Thumbnail; target.Thumbnail = null; Thread.Sleep(0); File.Delete(deleting.AbsoluteMasterPath); s_logger.Debug($"Deleted File:{deleting.AbsoluteMasterPath}"); ThumbnailFacade.DeleteWhereIDIs(deleting.ID); }
internal static void DeleteRecordFromStorage(PageViewModel page, DataOperationUnit dataOpUnit = null) { Debug.Assert(page != null); PageFacade.DeleteWhereIDIs(page.ID, dataOpUnit); ImageFacade.DeleteWhereIDIs(page.ImageID, dataOpUnit); if (page.Image != null) { var image = page.Image; if (image.ThumbnailRecorded) { if (!image.ThumbnailLoaded) { image.Thumbnail = ThumbnailFacade.FindByImageID(image.ID, dataOpUnit); } ThumbnailFacade.DeleteWhereIDIs(image.Thumbnail.ID, dataOpUnit); } } }