private void DeleteImage(string imageGalleryName, string imageName, ImageGalleryImageSettingsRecord imageSettings) { if (imageSettings != null) { _imageRepository.Delete(imageSettings); } _mediaService.DeleteFile(GetMediaPath(imageGalleryName), imageName); }
private void UpdateImageProperties(string imageGalleryName, string imageName, string imageTitle, string imageCaption, int? position) { var image = GetImage(imageGalleryName, imageName); var imageGallery = GetImageGallery(imageGalleryName); var imageGallerySettings = GetImageGallerySettings(imageGallery.MediaPath); if (imageGallerySettings.ImageSettings.Any(o => o.Name == image.Name)) { var imageSetting = imageGallerySettings.ImageSettings.Single(o => o.Name == image.Name); imageSetting.Caption = imageCaption; imageSetting.Title = imageTitle; if (position.HasValue) imageSetting.Position = position.Value; _imageRepository.Update(imageSetting); // TODO: Remove when cascade is fixed } else { var imageSetting = new ImageGalleryImageSettingsRecord {Caption = imageCaption, Name = image.Name, Title = imageTitle}; if (position.HasValue) imageSetting.Position = position.Value; imageGallerySettings.ImageSettings.Add(imageSetting); _imageRepository.Create(imageSetting); // TODO: Remove when cascade is fixed } // TODO: See how to cascade changes _repository.Update(imageGallerySettings); }
private void DeleteImage(string imageGalleryName, string imageName, ImageGalleryImageSettingsRecord imageSettings) { if (imageSettings != null) { _imageRepository.Delete(imageSettings); } _mediaService.DeleteFile(GetMediaPath(imageGalleryName), imageName); _thumbnailService.DeleteThumbnail(_storageProvider.Combine(GetMediaPath(imageGalleryName), imageName)); }