Пример #1
0
        public async Task DeleteAsync(string id)
        {
            var image = this.imagesRepository
                        .All()
                        .FirstOrDefault(i => i.Id == id);

            if (image != null)
            {
                var avatarUrl = image.Url;

                this.imagesRepository.Delete(image);
                await this.imagesRepository.SaveChangesAsync();

                await ApplicationCloudinary.DeleteFileAsync(this.cloudinary, avatarUrl);
            }
        }
Пример #2
0
 public async Task DeleteFromCloudAsync(string url)
 => await ApplicationCloudinary.DeleteFileAsync(this.cloudinary, url);