本文整理汇总了C#中Orchard.ContentManagement.ContentItem.Is方法的典型用法代码示例。如果您正苦于以下问题:C# ContentItem.Is方法的具体用法?C# ContentItem.Is怎么用?C# ContentItem.Is使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orchard.ContentManagement.ContentItem
的用法示例。
在下文中一共展示了ContentItem.Is方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EditAsync
public override async Task<IDisplayResult> EditAsync(ContentItem model, IUpdateModel updater)
{
// This method can get called when a new content item is created, at that point
// the query string contains a ListPart.ContainerId value, or when an
// existing content item has ContainedPart value. In both cases the hidden field
// needs to be rendered in the edit form to maintain the relationship with the parent.
if (model.Is<ContainedPart>())
{
return BuildShape(model.As<ContainedPart>().ListContentItemId);
}
var viewModel = new EditContainedPartViewModel();
if ( await updater.TryUpdateModelAsync(viewModel, "ListPart"))
{
// We are editing a content item that needs to be added to a container
// so we render the container id as part of the form
return BuildShape(viewModel.ContainerId);
}
return null;
}
示例2: RemoveVersion
public void RemoveVersion(ContentItem item)
{
_content.Remove(item);
if (item.Is<VersionInfoPart>()) {
item.As<VersionInfoPart>().Removed = true;
item.As<VersionInfoPart>().Draft = false;
}
}
示例3: PublishVersion
public void PublishVersion(ContentItem item)
{
Publish(item);
if (item.Is<VersionInfoPart>()) {
item.As<VersionInfoPart>().Removed = false;
item.As<VersionInfoPart>().Draft = false;
}
}