当前位置: 首页>>代码示例>>C#>>正文


C# IUpdateModel类代码示例

本文整理汇总了C#中IUpdateModel的典型用法代码示例。如果您正苦于以下问题:C# IUpdateModel类的具体用法?C# IUpdateModel怎么用?C# IUpdateModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IUpdateModel类属于命名空间,在下文中一共展示了IUpdateModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateTypeEditorAsync

        public Task<dynamic> UpdateTypeEditorAsync(ContentTypeDefinition contentTypeDefinition, IUpdateModel updater, string groupId)
        {
            if (contentTypeDefinition == null)
            {
                throw new ArgumentNullException(nameof(contentTypeDefinition));
            }

            dynamic contentTypeDefinitionShape = CreateContentShape("ContentTypeDefinition_Edit");
            contentTypeDefinitionShape.ContentTypeDefinition = contentTypeDefinition;

            _contentDefinitionManager.AlterTypeDefinition(contentTypeDefinition.Name, typeBuilder =>
            {
                var typeContext = new UpdateTypeEditorContext(
                    typeBuilder,
                    contentTypeDefinitionShape,
                    groupId,
                    _shapeFactory,
                    _layoutAccessor.GetLayout(),
                    updater
                );

                BindPlacementAsync(typeContext).Wait();

                _handlers.InvokeAsync(handler => handler.UpdateTypeEditorAsync(contentTypeDefinition, typeContext), Logger).Wait();

            });

            return Task.FromResult<dynamic>(contentTypeDefinitionShape);
        }
开发者ID:jchenga,项目名称:Orchard2,代码行数:29,代码来源:DefaultContentDefinitionDisplayManager.cs

示例2: UpdateSettings

 public dynamic UpdateSettings(IUpdateModel updater)
 {
     var settings = _contentManager.Get<SeoGlobalSettingsPart>(GetGlobalSettings().ContentItem.Id, VersionOptions.DraftRequired);
     var editor = _contentManager.UpdateEditor(settings, updater);
     _contentManager.Publish(settings.ContentItem);
     return editor;
 }
开发者ID:CloudMetal,项目名称:CloudMetal-Pipeline-Deploy,代码行数:7,代码来源:SeoSettingsManager.cs

示例3: FilterAsync

        public async Task FilterAsync(IQuery<ContentItem> query, ListContentsViewModel model, PagerParameters pagerParameters, IUpdateModel updateModel)
        {
            var viewModel = new ListPartContentAdminFilterModel();
            if(await updateModel.TryUpdateModelAsync(viewModel, ""))
            {
                // Show list content items 
                if (viewModel.ShowListContentTypes)
                {
                    var listableTypes = _contentDefinitionManager
                        .ListTypeDefinitions()
                        .Where(x =>
                            x.Parts.Any(p =>
                                p.PartDefinition.Name == nameof(ListPart)))
                        .Select(x => x.Name);

                    query.With<ContentItemIndex>(x => x.ContentType.IsIn(listableTypes));
                }

                // Show contained elements for the specified list
                else if(viewModel.ListContentItemId != 0)
                {
                    query.With<ContainedPartIndex>(x => x.ListContentItemId == viewModel.ListContentItemId);
                }
            }
        }
开发者ID:MichaelPetrinolis,项目名称:Orchard2,代码行数:25,代码来源:ListPart.cs

示例4: TypePartEditorUpdate

        public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "RelatedContentPart") yield break;

            var viewModel = new PropertyFieldsViewModel();
            updateModel.TryUpdateModel(viewModel, "PropertyFieldsViewModel", null, null);
            var settings = new RelatedContentRelationshipSettings();
            foreach (var relationshipFieldsModel in viewModel.Fields)
            {
                settings.DisplayName += String.Format("<field>{0}</field>", relationshipFieldsModel.DisplayName);
                settings.RelatedContentFields += String.Format("<field>{0}</field>", relationshipFieldsModel.RelatedContentFields);
                settings.RelatedcontentType += String.Format("<field>{0}</field>", relationshipFieldsModel.RelatedcontentType);
            }

            builder.WithSetting("RelatedContentRelationshipSettings.RelatedcontentType",
                settings.RelatedcontentType);
            builder.WithSetting("RelatedContentRelationshipSettings.RelatedContentFields",
                settings.RelatedContentFields);
            builder.WithSetting("RelatedContentRelationshipSettings.DisplayName",
                settings.DisplayName);

            var model = GetModel(settings);

            yield return DefinitionTemplate(model);
        }
开发者ID:kubo08,项目名称:Orchard,代码行数:25,代码来源:RelatedContentRelationshipSettingsEvents.cs

示例5: Display

        public override IDisplayResult Display(ContentItem contentItem, IUpdateModel updater)
        {
            var testContentPart = contentItem.As<TestContentPartA>();

            if (testContentPart == null)
            {
                return null;
            }

            return Combine(
                // A new shape is created and the properties of the object are bound to it when rendered
                Shape("TestContentPartA", testContentPart).Location("Detail", "Content"),
                // New shape, no initialization, custom location
                Shape("LowerDoll").Location("Detail", "Footer"),
                // New shape 
                Shape("TestContentPartA",
                    ctx => ctx.New.TestContentPartA().Creating(_creating++),
                    shape =>
                    {
                        shape.Processing = _processing++;
                        return Task.CompletedTask;
                    })
                    .Location("Detail", "Content")
                    .Cache("lowerdoll2", cache => cache.During(TimeSpan.FromSeconds(5))),
                // A strongly typed shape model is used and initialized when rendered
                Shape<TestContentPartAShape>(shape => { shape.Line = "Strongly typed shape"; return Task.CompletedTask; })
                    .Location("Detail", "Content:2"),
                // Cached shape
                Shape("LowerDoll")
                    .Location("Detail", "/Footer")
                    .Cache("lowerdoll", cache => cache.During(TimeSpan.FromSeconds(5)))
                );
        }
开发者ID:MichaelPetrinolis,项目名称:Orchard2,代码行数:33,代码来源:TestContentDisplay.cs

示例6: PartFieldEditorUpdate

        public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
            if (builder.FieldType != "ReferenceField") {
                yield break;
            }
            var model = new ReferenceFieldSettings();
            if (updateModel.TryUpdateModel(model, "ReferenceFieldSettings", null, null)) {
                UpdateSettings(model, builder, "ReferenceFieldSettings");

                if (model.QueryId <= 0) {
                    model.QueryId = CreateQuery(model.ContentTypeName.ToString(CultureInfo.InvariantCulture));
                }

                if (model.RelationshipId <= 0) {
                    var httpContext = _httpContextAccessor.Current();
                    var routeValues = httpContext.Request.RequestContext.RouteData.Values;
                    var entityName = routeValues["id"].ToString();
                    model.RelationshipId = _relationshipService.CreateOneToManyRelationship(builder.Name, model.RelationshipName, model.ContentTypeName, entityName);
                }

                if (model.QueryId <= 0 || model.RelationshipId <= 0) {
                    updateModel.AddModelError("QueryOrRelation", T("Invalid Query or Relationship Id"));
                    yield break;
                }

                UpdateSettings(model, builder, "ReferenceFieldSettings");
                builder.WithSetting("ReferenceFieldSettings.DisplayAsLink", model.DisplayAsLink.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("ReferenceFieldSettings.ContentTypeName", model.ContentTypeName.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("ReferenceFieldSettings.RelationshipName", model.RelationshipName.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("ReferenceFieldSettings.RelationshipId", model.RelationshipId.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("ReferenceFieldSettings.QueryId", model.QueryId.ToString(CultureInfo.InvariantCulture));
            }
            yield return DefinitionTemplate(model);
        }
开发者ID:jgtaveras,项目名称:Coevery,代码行数:33,代码来源:ReferenceFieldEditorEvents.cs

示例7: PartFieldEditorUpdate

        public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (!builder.FieldType.Equals(typeof(MoneyField).Name)) yield break;

            var model = new MoneyFieldSettings();

            if (updateModel.TryUpdateModel(model, typeof(MoneyFieldSettings).Name, null, null))
            {
                if (string.IsNullOrEmpty(model.DefaultCurrency))
                {
                    builder.WithSetting("MoneyFieldSettings.DefaultCurrency", Currency.FromCurrentCulture().Iso3LetterCode);
                }
                else
                {
                    Currency parsedCurrency;
                    if (Currency.TryParse(model.DefaultCurrency, out parsedCurrency))
                    {
                        builder.WithSetting("MoneyFieldSettings.DefaultCurrency", model.DefaultCurrency);
                    }
                    else
                    {
                        updateModel.AddModelError("InvalidCurrencyIsoCode", T("MoneyField - Invalid currency iso code was given."));
                    }
                }

                builder.WithSetting("MoneyFieldSettings.IsCurrencyReadOnly", model.IsCurrencyReadOnly.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("MoneyFieldSettings.Hint", model.Hint);
                builder.WithSetting("MoneyFieldSettings.Required", model.Required.ToString(CultureInfo.InvariantCulture));
            }
            yield return DefinitionTemplate(model);
        }
开发者ID:SmartFire,项目名称:Lombiq-Fields,代码行数:31,代码来源:MoneyFieldEditorEvents.cs

示例8: UpdateEditor

 public dynamic UpdateEditor(IContent content, IUpdateModel updater, string groupInfoId) {
     var contentKey = "ContentUpdate:" + content.Id.ToString();
     _profiler.StepStart(contentKey, String.Format("Content Update: {0}", content.Id));
     var result = _innerContentDisplay.UpdateEditor(content, updater, groupInfoId);
     _profiler.StepStop(contentKey);
     return result;
 }
开发者ID:bigfont,项目名称:CertifiedOverheadCrane,代码行数:7,代码来源:ProfilingContentDisplay.cs

示例9: UpdateEditor

 public dynamic UpdateEditor(IContent content, IUpdateModel updater, string groupId = "") {
     var shape = _origami.ContentShape(content, "", true);
     var builder = _origami.ContentBuilder(content).WithMode("Editor").WithUpdater(updater, "");
     if (!String.IsNullOrWhiteSpace(groupId)) builder.WithGroup(groupId);
     _origami.Build(builder, shape);
     return shape;
 }
开发者ID:akhurst,项目名称:ricealumni,代码行数:7,代码来源:OrigamiContentDisplay.cs

示例10: PartEditorUpdate

 public override IEnumerable<TemplateViewModel> PartEditorUpdate(ContentPartDefinitionBuilder builder, IUpdateModel updateModel)
 {
     var model = new ContentPartSettings();
     updateModel.TryUpdateModel(model, "ContentPartSettings", null, null);
     builder.Attachable(model.Attachable);
     yield return DefinitionTemplate(model);
 }
开发者ID:kerrjon,项目名称:MNFathers,代码行数:7,代码来源:EditorEvents.cs

示例11: UpdateEditorContext

 public UpdateEditorContext(IShape model, IContent content, IUpdateModel updater, string groupInfoId, IShapeFactory shapeFactory, ShapeTable shapeTable, string path)
     : base(model, content, groupInfoId, shapeFactory) {
     
     ShapeTable = shapeTable;
     Updater = updater;
     Path = path;
 }
开发者ID:anycall,项目名称:Orchard,代码行数:7,代码来源:UpdateEditorContext.cs

示例12: TypePartEditorUpdate

        public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel) {
            if (builder.Name != typeof (TermPart).Name) yield break;

            var settings = new ExtraTermPartSettings();
            updateModel.TryUpdateModel(settings, typeof (ExtraTermPartSettings).Name, null, null);
            builder.WithSetting("ExtraTermPartSettings.OnlyDirectChildren", settings.OnlyDirectChildren.ToString());
        }
开发者ID:Devqon,项目名称:Devq.Sellit,代码行数:7,代码来源:ExtraTermPartSettingsEvents.cs

示例13: TypeEditorUpdate

        public override IEnumerable<TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel) {
            var model = new ContentTypeSettings();
            updateModel.TryUpdateModel(model, "ContentTypeSettings", null, null);
            builder.Creatable(model.Creatable);
            builder.Draftable(model.Draftable);

            yield return DefinitionTemplate(model);
        }
开发者ID:sjbisch,项目名称:Orchard,代码行数:8,代码来源:EditorEvents.cs

示例14: TypeEditorUpdate

        public override IEnumerable<TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel)
        {
            var model = new AssociativyTaxonomiesAdapterTypeSettings();
            updateModel.TryUpdateModel(model, "AssociativyTaxonomiesAdapterTypeSettings", null, null);
            builder.WithSetting("AssociativyTaxonomiesAdapterTypeSettings.GraphNamesSerialized", model.GraphNamesSerialized);

            yield return DefinitionTemplate(model);
        }
开发者ID:Lombiq,项目名称:Associativy-Taxonomies-Adapter,代码行数:8,代码来源:TypeSettings.cs

示例15: PartFieldEditorUpdate

        public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
            var model = new DateTimeFieldSettings();
            if(updateModel.TryUpdateModel(model, "DateTimeFieldSettings", null, null)) {
                builder.WithSetting("DateTimeFieldSettings.Display", model.Display.ToString());
            }

            yield return DefinitionTemplate(model);
        }
开发者ID:dminik,项目名称:voda_code,代码行数:8,代码来源:DateTimeFieldEditorEvents.cs


注:本文中的IUpdateModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。