Beispiel #1
0
        public Attachment NewPdfObject(AttachmentDto attachment, int userId, string bucketName,
                                       FileStream file, string originalName, string fileName, bool isMain = false, int?documentId = null)
        {
            var newAttachment = new Attachment
            {
                OriginalName = originalName,
                ValidName    = fileName.MakeValidFileName(),
                IsMain       = isMain,
                CopyCount    = attachment.CopyCount,
                PageCount    = _fileConverter.PageCount(file),
                Length       = file.Length,
                ContentType  = attachment.ContentType,
                Hash         = GenerateFileHash(file),
                AuthorId     = userId,
                BucketName   = bucketName,
                DocumentId   = documentId
            };

            return(newAttachment);
        }