How do I create a new page in orchard module? I have one page and controller in orchard, but how to add a new page in the route module?
public IEnumerable<RouteDescriptor> GetRoutes() {
return new[] {
new RouteDescriptor {
Priority = 5,
Route = new Route(
"BlogX", // this is the name of the page url
new RouteValueDictionary {
{"area", "BlogX"}, // this is the name of your module
{"controller", "Home"},
{"action", "Index"}
},
new RouteValueDictionary(),
new RouteValueDictionary {
{"area", "BlogX"} // this is the name of your module
},
new MvcRouteHandler())
}
};
}
This should be easy. Inject an instance of
Orchard.ContentManagement.IContentManagerto your controller and then simply callContentManager.New("YourContentType"). Also have a look at the other methods available for the content manager likePublish()which you may need to call also.