/// <summary> /// Uploadasync the files in the folder /// </summary> /// <param name="folderName">Folder in web application project to upload files from</param> /// <param name="container">Destination BLOB Storage container to upload files to</param> private async Task UploadBlobAsync(BlobAggregate file, CloudBlobContainer container) { string reference = string.Format("{0}/{1}", file.DirectoryName, file.FileName); var blobFile = container.GetBlockBlobReference(reference); if (!blobFile.Exists()) { await blobFile.UploadFromStreamAsync(file.Content); } }
public async Task BlobManagementServicesTests_Should_upload_ExistingFile() { BlobAggregate blob = new BlobAggregate(); blob.FileName = "TestImage.jpg"; blob.DirectoryName = "TestFiles"; blob.Content = File.OpenRead(@"TestImage.jpg"); IBlobManagementServices manager = IoCFactory.Instance.CurrentContainer.Resolve <IBlobManagementServices>(); await manager.UploadBlobAsync(blob); Assert.IsNotNull(blob); }
/// <summary> /// <see cref="Domain.Core.IRepository{TEntity}"/> /// </summary> /// <param name="file"><see cref="Application.BoundedConext.Blob"/></param> public Task UploadBlobAsync(BlobAggregate file) { this._blobRepository.Add(file); return(this._blobRepository.UnitOfWork.CommitAsync()); }