public IDictionary<string, object> GetParameters(ActionDescriptor actionDescriptor) { IDictionary<string, object> parameterDict = new Dictionary<string,object>(); ParameterDescriptor[] parameters = actionDescriptor.GetParameters(); foreach (ParameterDescriptor parameterDescriptor in parameters) { parameterDict[parameterDescriptor.ParameterName] = GetParameter(this.Context,parameterDescriptor); } return parameterDict; }
public ActionResult InvokeActionMethod(ActionDescriptor actionDescriptor) { if (actionDescriptor == null) { throw new ArgumentNullException("actionDescriptor"); } IDictionary<string, object> parameters = GetParameters(actionDescriptor); object returnObj = actionDescriptor.Execute(this.Context,parameters); ActionResult result = (returnObj as ActionResult) ?? new ContentResult { Content=returnObj.ToString()}; return result; }