public DownloadFileModel RetrieveUploadErrorsFile(string blobAddress) { var memoryStream = new MemoryStream(); var container = BlobClient.CreateContainer(ServiceFileContainerName); container.DownloadToStream(blobAddress, memoryStream); var downloadFile = new DownloadFileModel { FileName = blobAddress, FileContentStream = memoryStream }; downloadFile.FileContentStream.Position = 0; return downloadFile; }
public DownloadFileModel RetrieveUploadErrorsFile(string blobAddress) { var memoryStream = new MemoryStream(); var downloadFile = new DownloadFileModel { FileName = blobAddress, FileContentStream = memoryStream }; DataFileBlobContainer.DownloadToStream(blobAddress, memoryStream); downloadFile.FileContentStream.Position = 0; return downloadFile; }
public DownloadFileModel CreateTemplateDownload(EducationSecurityPrincipal user, string templatePath, int serviceOfferingId) { var offering = ServiceOfferingRepository.Items.Include(s => s.Provider). Include(s => s.ServiceType). Include(s => s.Program). SingleOrDefault(s => s.Id == serviceOfferingId); if (offering == null) { return null; } if (!GrantUserAccessToUploadOffering(user, offering)) { throw new EntityAccessUnauthorizedException("You are not have the appropriate rights to download this service offering."); } var processor = new WorksheetWriter(offering, ServiceOfferingSheetName); var fileName = string.Format(CultureInfo.InvariantCulture, "{0}{1}", offering.Name.GetSafeFileName(), ".xlsx"); var downloadFile = new DownloadFileModel { FileName = fileName, BlobAddress = string.Empty }; ExcelWriter writer = new ExcelWriter(); writer.InitializeFrom(templatePath, processor); downloadFile.FileContentStream = writer.FileContentStream; downloadFile.FileContentStream.Position = 0; return downloadFile; }