Exemplo n.º 1
0
        public static IMVCResult AsMVCResult(this ActionResult actionResult)
        {
            var mvcResult = new MVCResult();
            var properties = actionResult.GetType().GetProperties();

            if (properties != null)
            {
                mvcResult.Controller = (string)properties.Where(p => p.Name == "Controller").First().GetValue(actionResult, null);
                mvcResult.Action = (string)properties.Where(p => p.Name == "Action").First().GetValue(actionResult, null);
                mvcResult.RouteValueDictionary = (RouteValueDictionary)properties.Where(p => p.Name == "RouteValueDictionary").First().GetValue(actionResult, null);
            }

            return mvcResult;
        }
Exemplo n.º 2
0
        public static IMVCResult AsMVCResult(this ActionResult actionResult)
        {
            var mvcResult  = new MVCResult();
            var properties = actionResult.GetType().GetProperties();

            if (properties != null)
            {
                mvcResult.Controller           = (string)properties.Where(p => p.Name == "Controller").First().GetValue(actionResult, null);
                mvcResult.Action               = (string)properties.Where(p => p.Name == "Action").First().GetValue(actionResult, null);
                mvcResult.RouteValueDictionary = (RouteValueDictionary)properties.Where(p => p.Name == "RouteValueDictionary").First().GetValue(actionResult, null);
            }

            return(mvcResult);
        }