Пример #1
0
        private async Task CreateCore(CreateContent c, ContentOperation operation)
        {
            operation.MustNotCreateSingleton();
            operation.MustNotCreateForUnpublishedSchema();
            operation.MustHaveData(c.Data);

            if (!c.DoNotValidate)
            {
                await operation.ValidateInputAsync(c.Data, c.OptimizeValidation, Snapshot.IsPublished());
            }

            var status = await operation.GetInitialStatusAsync();

            if (!c.DoNotScript)
            {
                c.Data = await operation.ExecuteCreateScriptAsync(c.Data, status);
            }

            operation.GenerateDefaultValues(c.Data);

            if (!c.DoNotValidate)
            {
                await operation.ValidateContentAsync(c.Data, c.OptimizeValidation, Snapshot.IsPublished());
            }

            Create(c, status);
        }
Пример #2
0
        private async Task CreateDraftCore(CreateContentDraft c, ContentOperation operation)
        {
            operation.MustHavePermission(Permissions.AppContentsVersionCreate);
            operation.MustCreateDraft();

            var status = await operation.GetInitialStatusAsync();

            CreateDraft(c, status);
        }