我正在使用Umbraco劫持控制器,即RenderMvcController。就我而言,我想使用umbraco.TypedSearch方法。由于劫持控制器,我制作了一个方法createRenderModel(IPublishedContent)。这是该方法的实现。
private RenderModel CreateRenderModel(IPublishedContent content)
{
var model = new RenderModel(content, CultureInfo.CurrentUICulture);
RouteData.DataTokens["umbraco-doc-request"] = model;
RouteData.DataTokens["umbraco"] = model;
return model;
}
我的控制器的动作结果代码是
public ActionResult Web(RenderModel model, string search)
{
var region = CookieHelpers.GetCurrentRegion();
var regionpage = UmbracoHelpers.GetSelectableCountry(region);
var pathid = string.Empty;
if(regionpage!=null)
{
pathid = regionpage.Id.ToString();
}
var viewModel = CreateRenderModel(regionpage);
//Here i Got Error
var a = currentNode.TypedSearch(search).Where(x => x.DocumentTypeAlias == "retailer" && x.Path.Contains(pathid)).ToList();
return View();
}