示例#1
0
        public SaveResult Save(Guid userId, out string fileName)
        {
            fileName = string.Empty;
            if (!fuFile.HasFile)
            {
                return(SaveResult.FileEmpty);
            }

            var file = CurrentFile ?? new File {
                FileName = fuFile.FileName, UploadFileName = fuFile.FileName
            };

            file.FileSize = fuFile.FileBytes.Length;

            file = Wiki.CreateOrUpdateFile(file);

            try
            {
                FileContentSave(file.FileLocation, fuFile.FileBytes, WikiSection.Section, TenantId);
            }
            catch (TenantQuotaException)
            {
                Wiki.RemoveFile(file.FileName);
                return(SaveResult.FileSizeExceeded);
            }

            _fileInfo = file;

            RisePublishVersionInfo(file);
            fileName = file.FileName;

            return(SaveResult.Ok);
        }