﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Web;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;

namespace FiltersSample.Filters
{
    public class ValueActionFilter : ActionFilterAttribute
    {
        public override void OnActionExecuting(HttpActionContext actionContext)
        {
            var isRequestValid_MethodInfo = actionContext.ControllerContext.Controller.GetType().GetMethod("IsRequestValid", BindingFlags.NonPublic | BindingFlags.Instance);
            var ctrl_Instance = actionContext.ControllerContext.Controller;
            isRequestValid_MethodInfo.Invoke(ctrl_Instance, new object[] { actionContext, actionContext.ActionArguments });            
        }
    }
}