Hi, every time we do something with Url’s we need to pass PageModel, CategoryModel and ProductModel currentProductModel to the method. Typically we do this from a ChildAction call from the View.
[ChildActionOnly]
public ActionResult Header(PageModel currentPageModel, CategoryModel currentCategory, ProductModel currentProductModel)
{
var viewModel = _headerViewModelBuilder.Build(currentPageModel, currentCategory, currentProductModel);
return PartialView("Framework/Header", viewModel);
}
But this pattern is all over our code base, is there an alternative to passing this all over? I know that we have _requestModelAccessor.RequestModel.CurrentPageModel but we dont have all of them?
Any suggestion of a better pattern to use? Injecting them outside of the View give: Service ‘Litium.Web.Models.Websites.PageModel’ which was not registered.
…
…
etc
Litium version: 7.4