Example #1
0
        /// <summary>
        /// Retrieves upload content.
        /// </summary>
        /// <param name="tenantId">Tenant identifier.</param>
        /// <param name="uploadId">Upload identifer.</param>
        /// <param name="storageHierarchy">Location of upload. E.g. { "Uploads" > "Users" }.</param>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <returns>Upload content.</returns>
        public Upload Read(long tenantId, long uploadId, List <string> storageHierarchy, IUnitOfWork unitOfWork = null)
        {
            // Get main upload details from upload repository
            Upload upload = _uploadRepository.Read(tenantId, uploadId, unitOfWork);

            // Get upload content from underlying storage and populate upload object
            UploadContent uploadContent = _storageService.Read(upload, storageHierarchy, unitOfWork);

            upload.Content     = uploadContent.Content;
            upload.ContentType = uploadContent.ContentType;

            // Return upload
            return(upload);
        }