Ejemplo n.º 1
0
        public async Task <dynamic> UpdateTypeEditorAsync(ContentTypeDefinition contentTypeDefinition, IUpdateModel updater, string groupId)
        {
            if (contentTypeDefinition == null)
            {
                throw new ArgumentNullException(nameof(contentTypeDefinition));
            }

            dynamic contentTypeDefinitionShape = await CreateContentShapeAsync("ContentTypeDefinition_Edit");

            contentTypeDefinitionShape.ContentTypeDefinition = contentTypeDefinition;

            var layout = await _layoutAccessor.GetLayoutAsync();

            await _contentDefinitionManager.AlterTypeDefinitionAsync(contentTypeDefinition.Name, async typeBuilder =>
            {
                var typeContext = new UpdateTypeEditorContext(
                    typeBuilder,
                    contentTypeDefinitionShape,
                    groupId,
                    false,
                    _shapeFactory,
                    layout,
                    updater
                    );

                await BindPlacementAsync(typeContext);

                await _handlers.InvokeAsync((handler, contentTypeDefinition, typeContext) => handler.UpdateTypeEditorAsync(contentTypeDefinition, typeContext), contentTypeDefinition, typeContext, _logger);
            });

            return(contentTypeDefinitionShape);
        }