Exemple #1
0
        public async Task <bool> Store(Guid documentId, IFormFile file)
        {
            var compressedFile = _compressionService.Compress(file);
            var encryptedFile  = _encryptionService.Encrypt(compressedFile);

            _contentTypeProvider.TryGetContentType(file.FileName, out string contentType);
            var documentContent = new DocumentContentEntity()
            {
                DocumentId = documentId,
                Content    = encryptedFile,
                Length     = encryptedFile.Length,
                Name       = file.FileName,
                Type       = contentType
            };

            return(await _repo.Store(documentContent));
        }