public async Task <bool> DeleteData(StoreFileInfo fileInfo)
        {
            try
            {
                Account account = new Account(
                    this.cloudName,
                    this.apiKey,
                    this.apiSecret);

                Cloudinary     cloudinary     = new Cloudinary(account);
                DeletionParams deletionParams = new DeletionParams(fileInfo.FileId);
                DeletionResult result         = await cloudinary.DestroyAsync(deletionParams);

                if (result.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                this.Logger.LogError(e, e.Message);
                return(false);
            }
        }
Example #2
0
        public async Task <bool> DeleteData(StoreFileInfo fileInfo)
        {
            try
            {
                if (!this.ParseBlockName(fileInfo.FileAddress, out string container, out string folder, out string fileName))
                {
                    return(false);
                }

                BlobContainerClient blobContainer = new BlobContainerClient(this.connection, container);
                await blobContainer.CreateIfNotExistsAsync();

                // Get a reference to a blob named "sample-file" in a container named "sample-container"
                BlobClient blob     = blobContainer.GetBlobClient(folder + "/" + fileName);
                Response   response = await blob.DeleteAsync();

                return(true);
            }
            catch (Exception e)
            {
                this.Logger.LogError(e, e.Message);
                return(false);
            }
        }
 public Task <bool> DeleteData(StoreFileInfo fileInfo)
 {
     throw new NotImplementedException();
 }