I have a generic action filter, and i want to get current model in the OnActionExecuting method. My current implementation is like below:
OnActionExecuting
public
You can use ActionExecutingContext.Controller property
ActionExecutingContext.Controller
/// /// Gets the controller instance containing the action. /// public virtual object Controller { get; }
and converting result to base MVC Controller get access to model:
((Controller)actionExecutingContext.Controller).ViewData.Model