Project Description
Trigger for Orchard use Razor expression.

Sample Code:

Condition:

@if (Model.Content.ContentType == "Page")
{
@: true
}
else
{
@: false
}



Action:

@using Orchard;
@using Orchard.Security;
@using Orchard.Settings;
@using Orchard.ContentManagement;
@using Orchard.ContentManagement.Handlers;
@using Orchard.ContentManagement.Aspects;
@using Orchard.Core.Common.Models;
@using RaisingStudio.Trigger.Services;
@using RaisingStudio.Razor.Services;
@using RaisingStudio.Trigger.Models;
@using RaisingStudio.Razor.Models;

@{
IContentManager contentManager = Model.ContentManager;
var bodyText = Model.As<BodyPart>().Text;
var razorPage = contentManager.Create<RazorContentPart>("RazorPage", VersionOptions.Draft);
razorPage.Template = bodyText;
contentManager.Publish(razorPage.ContentItem);

@: true
}




Last edited May 7, 2011 at 10:51 AM by zhong_zhaofeng, version 4