Ejemplo n.º 1
0
        private void DeleteThumbsAndIcons(Photo photoFromRepo)
        {
            IImageFileManager imageFileManager = GetImageFileManager(StorageType.Local);

            if (!string.IsNullOrEmpty(photoFromRepo.ThumbnailUrl))
            {
                imageFileManager.DeleteImage(photoFromRepo.ThumbnailUrl);
            }
            if (!string.IsNullOrEmpty(photoFromRepo.IconUrl))
            {
                imageFileManager.DeleteImage(photoFromRepo.IconUrl);
            }
        }
Ejemplo n.º 2
0
        public ImageFileResult DeleteImageFile(Photo photoFromRepo)
        {
            DeleteThumbsAndIcons(photoFromRepo);
            IImageFileManager imageFileManager = GetImageFileManager(photoFromRepo.StorageType);

            return(imageFileManager.DeleteImage(photoFromRepo.PublicId));
        }
Ejemplo n.º 3
0
        public async Task DeleteImageFileAsync(Photo photoFromRepo)
        {
            DeleteThumbsAndIcons(photoFromRepo);
            IImageFileManager imageFileManager = GetImageFileManager(photoFromRepo.StorageType);

            if (imageFileManager != null)
            {
                var task = await Task.Run(() =>
                {
                    var result = imageFileManager.DeleteImage(photoFromRepo.PublicId);
                    return(result);
                });

                if (!string.IsNullOrEmpty(task.Error))
                {
                    Console.WriteLine(task.Error);
                    this._logger.LogError(task.Error);
                }
            }
        }