public FileWrapper <T> CreateFile(T folderId, string title, JsonElement templateId, bool enableExternalExt = false)
        {
            File <T> file;

            if (templateId.ValueKind == JsonValueKind.Number)
            {
                file = FileStorageService.CreateNewFile(new FileModel <T, int> {
                    ParentId = folderId, Title = title, TemplateId = templateId.GetInt32()
                }, enableExternalExt);
            }
            else if (templateId.ValueKind == JsonValueKind.String)
            {
                file = FileStorageService.CreateNewFile(new FileModel <T, string> {
                    ParentId = folderId, Title = title, TemplateId = templateId.GetString()
                }, enableExternalExt);
            }
            else
            {
                file = FileStorageService.CreateNewFile(new FileModel <T, int> {
                    ParentId = folderId, Title = title, TemplateId = 0
                }, enableExternalExt);
            }

            return(FileWrapperHelper.Get(file));
        }
Example #2
0
        public FileWrapper <T> CreateFile(T folderId, string title, T templateId)
        {
            var file = FileStorageService.CreateNewFile(new FileModel <T> {
                ParentId = folderId, Title = title, TemplateId = templateId
            });

            return(FileWrapperHelper.Get(file));
        }