Пример #1
0
        protected virtual T GetActionResult <T>(string actionName, RequestValues values, Action <T> execute)
        {
            var param  = values.ToArray();
            var method = GetMethod(actionName, param);

            if (method == null)
            {
                return(default(T));
            }

            this.RequestContext.ActionName = method.Name;

            var result = (T)method.Invoke(this, param);

            execute?.Invoke(result);
            return(result);
        }
Пример #2
0
        protected virtual T GetActionResult <T>(
            string actionName,
            RequestValues values,
            Action <T> execute)
        {
            object[]   array  = values.ToArray();
            MethodInfo method = this.GetMethod(actionName, array);

            if (method == (MethodInfo)null)
            {
                return(default(T));
            }
            this.RequestContext.ActionName = method.Name;
            T obj = (T)method.Invoke((object)this, array);

            if (execute != null)
            {
                execute(obj);
            }
            return(obj);
        }