How do I access the root node from a surface controller called from outside of Umbraco?
I have created a surface controller that takes the CurrentPage and uses that to find the root node of the tree and from there, creates a PartialView menu of the entire site.
I need to be able to call this surface controller from a separate MVC area that is outside of the Umbraco pipeline. Inside the surface controller, how would I access the root node?
The following code works in a Surface Controller in v6 of Umbraco. It obtains the root node and then instantiates a new RenderModel with that information, before passing that off to the PartialView.
public class PageSurfaceController : SurfaceController
{
[ChildActionOnly]
public PartialViewResult Menu()
{
IPublishedContent root = Umbraco.TypedContentAtRoot().First();
RenderModel model = new RenderModel(root, new CultureInfo("en-US"));
return PartialView(model);
}
}
How do I access the root node from a surface controller called from outside of Umbraco?
I have created a surface controller that takes the CurrentPage and uses that to find the root node of the tree and from there, creates a PartialView menu of the entire site.
I need to be able to call this surface controller from a separate MVC area that is outside of the Umbraco pipeline. Inside the surface controller, how would I access the root node?
The following code works in a Surface Controller in v6 of Umbraco. It obtains the root node and then instantiates a new RenderModel with that information, before passing that off to the PartialView.
is working on a reply...