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