public void InvokeAction(ControllerContext controllerContext, string actionName)
 {
     var method = controllerContext.Controller.GetType().GetMethods().First(m => string.Compare(actionName, m.Name, true) == 0);
     var parameters = new List<object>();
     foreach (ParameterInfo parameter in method.GetParameters())
     {
         parameters.Add(this.ModelBinder.BindModel(controllerContext, parameter.Name, parameter.ParameterType));
     }
     ActionResult actionResult = (ActionResult)method.Invoke(controllerContext.Controller, parameters.ToArray());
     actionResult.ExecuteResult(controllerContext);
 }
Beispiel #2
0
 public abstract void ExecuteResult(ControllerContext context);
Beispiel #3
0
 public void Execute(RequestContext requestContext)
 {
     var context = new ControllerContext { RequestContext = requestContext, Controller = this };
     var actionName = requestContext.RouteData.ActionName;
     this.ActionInvoker.InvokeAction(context, actionName);
 }