arlen wrote:Is there any solution to access "PrepareCustomerInfoModel" method in CustomerController.cs from Plugin controller?
protected virtual void PrepareCustomerInfoModel(CustomerInfoModel model, Customer customer, bool excludeProperties)
{
//
}
You can create a new controller in your plugin that inherits from CustomerController, override the action result supplying a custom action name, and call your overridden implementation of PrepareCustomerInfoModel from that method.
[ActionName("MyCustomAction")]
new public ActionResult OverridenActionName(params) {
...
this.PrepareCustomerInfoModel(args);
}
...
protected override void PrepareCustomerInfoModel(params)
{
//if you need to alter code in the original method,
//you'll need to recreate it here, otherwise you can simply call the base method when needed
base.PrepareCustomerInfoModel(args);
}
and in your RouteProvider:
routes.MapRoute("MyCustomRoute",
"route/to/intercept",
new { controller = "CustomCustomer", action = "MyCustomAction" },
new[] { "my.namespace" }
);
Hope that helps!