I followed the article @ http://www.pronopcommerce.com/overriding-intercepting-nopcommerce-controllers-and-actions
I got an error:
The type 'Nop.Plugin.CRM.Zoho.ZohoRegistrarActionFilter' is not assignable to service 'System.Web.Mvc.IFilterProvider'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: The type 'Nop.Plugin.CRM.Zoho.ZohoRegistrarActionFilter' is not assignable to service 'System.Web.Mvc.IFilterProvider'.
I created three ActionFilter.cs to do different functionalities. one of them is like:
using System;
using System.Web;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nop.Web.Controllers;
using Nop.Services;
using Nop.Services.Customers;
using Nop.Services.Affiliates;
using Nop.Services.Common;
using Nop.Services.Localization;
using Nop.Services.Helpers;
using Nop.Services.Directory;
using Nop.Services.Logging;
using Nop.Core;
using Nop.Core.Infrastructure;
using Nop.Core.Domain;
using Nop.Core.Domain.Customers;
namespace Nop.Plugin.CRM.Zoho
{
public class ZohoRegistrarActionFilter : ActionFilterAttribute
{
public IEnumerable<Filter> GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
{
if (controllerContext.Controller is CustomerController &&
actionDescriptor.ActionName.Equals("RegisterResult",
StringComparison.InvariantCultureIgnoreCase)) {
return new List<Filter>() { new Filter(this, FilterScope.Action, 0) };
} return new List<Filter>();
}
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
//do stuff
}
}
}
I also registered them in DependencyRegistrar.cs as mentioned in the article:
using System;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autofac;
using Autofac.Core;
using Autofac.Integration.Mvc;
using Nop.Core.Infrastructure;
using Nop.Core.Infrastructure.DependencyManagement;
using Nop.Data;
using Nop.Core.Data;
using Nop.Web.Framework.Mvc;
namespace Nop.Plugin.CRM.Zoho
{
public class DependencyRegistrar : IDependencyRegistrar
{
public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder)
{
builder.RegisterType<ZohoCRMService>().As<IZohoCRMService>().InstancePerLifetimeScope();
builder.RegisterType<ZohoRegistrarActionFilter>().As<IFilterProvider>();
builder.RegisterType<ZohoSalesOrderActionFilter>().As<IFilterProvider>();
builder.RegisterType<ZohoEnquiryActionFilter>().As<IFilterProvider>();
}
public int Order
{
get { return 1; }
}
}
}
Could anyone help me to fix it?
Many Thanks,
Amy