I want to add a parameter on the Actionarguments, in order to bind my object, but allways the object is null and the property is not binded, why??
Maybe because that's a GET and not a POST? There's a solution for do that??
ActionFilter
public class CustomizedFilter : ActionFilterAttribute
{
/// <summary>
/// OnActionExecuting
/// </summary>
/// <param name="actionContext"></param>
public override void OnActionExecuting(HttpActionContext actionContext)
{
actionContext.ActionArguments.Add("Parameter", "Value");
}
}
Controller
[HttpGet]
[CustomizedFilter]
public RestResult Get(InputObject value)
{
}
InputObject
public class InputObject
{
public string Parameter{get;set;}
}
That's because Model Binding is already happened. So you need to implement custom model binder for your InputObject. Or you can write something like: