I need to override Admin action result for add product to order in my plugin.
But I am getting this error.
AmbiguousActionException: Multiple actions matched. The following actions matched route data and had all constraints satisfied:
I have write this code.
public class OrderController : Nop.Web.Areas.Admin.Controllers.OrderController
public virtual IActionResult AddProductToOrder(int orderId)
//[I will prepare model as per my requirement]
Please submit your suggestions.
Use action filter for prepare your model.
You can override PrepareAddProductToOrderSearchModel method in OrderModelFactory as per your requirement.
public partial class PluginModelFactory : IOrderModelFactory,OrderModelFactory
// your fields
public PluginModelFactory():base(// needed fields for base)
public override AddProductToOrderSearchModel
PrepareAddProductToOrderSearchModel(AddProductToOrderSearchModel searchModel, Order order)
// prepare your code as per your requirement
please register in your DependencyRegistrar.cs file.
Thanks for your suggestion.
This is service or factory override.
But I need a solution for IActionResult override.
suppose I in the order Edit ActionResult I need to change and result a view that is in my plugin
Because I need to change in edit order view pages.
in this case I need to override below method
public virtual IActionResult Edit(int id)
return View("~/Plugin/Views/Order/Edit.cshtml", Model);
is there any way to override this or not?