本文整理匯總了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;
}
}