same type action filter on controller and its action method

Viewed 722

i have defined an action filter like this:

public class InvokeConditionAttribute : ActionFilterAttribute
{
    private ConditionRule conditionRule;

    public InvokeConditionAttribute(ConditionRule conditionRule)
    {
        this.conditionRule = conditionRule;
    }

    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        // check condition rule
    }
}

ConditionRule in parameter is a enum type. then i create a controller like below:

[InvokeCondition(ConditionRule.Condition1, Order = 1)]
public class AttendanceModificationController : Controller
{
    [InvokeCondition(ConditionRule.Condition2, Order = 2)]
    public ActionResult SomeAction()
    {
        //
    }
}

problem is method level filter not invoke.

can define same filter type with different parameter in asp.net mvc?

1 Answers
Related