1

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

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

1 回答 1

1

这应该很容易。将 的实例注入Orchard.ContentManagement.IContentManager您的控制器,然后简单地调用ContentManager.New("YourContentType"). 另请查看内容管理器可用的其他方法Publish(),您可能还需要调用这些方法。

于 2017-11-14T10:01:43.517 回答