在Orchard模块中创建新页面

时间:2017-11-14 04:39:02

标签: orchardcms orchardcms-1.6 orchardcms-1.8 orchard-modules orchardcms-1.9

如何在orchard模块中创建新页面?我在果园中有一个页面和控制器,但是如何在路由模块中添加新页面?

        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())
            }
        };
    }

1 个答案:

答案 0 :(得分:1)

这应该很容易。将Orchard.ContentManagement.IContentManager的实例注入您的控制器,然后只需调用ContentManager.New("YourContentType")。另请参阅内容管理器可用的其他方法,例如Publish(),您也可能需要调用它们。