Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a Web API ActionFilterAttribute have access to model?

I'd like to be able to do some permission checks in a web api ActionFilter, so I need to be able to pull out the object ID. I can do this on a GET since I have access to RouteData, but is it possible to get access to the searlized viewModel object in an action filter for a PUT\POST?

 public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext)
    {
        if (actionContext == null)
        {
            throw new ArgumentNullException("actionContext");
        }

       //Get ID from searlized object and check permissions for a POST\PUT? 
    }
like image 358
NullReference Avatar asked Oct 02 '12 20:10

NullReference


1 Answers

Have you tried the ActionArguments property?

like image 185
André Scartezini Avatar answered Oct 10 '22 23:10

André Scartezini