Пример #1
0
 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;
 }
Пример #2
0
 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;
 }