Esempio n. 1
0
        private string getAreaName(System.Web.Mvc.ControllerDescriptor controllerDescriptor)
        {
            System.Web.Mvc.RouteAreaAttribute areaAttribute =
                controllerDescriptor.GetCustomAttributes(typeof(System.Web.Mvc.RouteAreaAttribute), inherit: true)
                .Cast <System.Web.Mvc.RouteAreaAttribute>()
                .FirstOrDefault();

            if (areaAttribute == null)
            {
                return(null);
            }

            if (areaAttribute.AreaName != null)
            {
                return(areaAttribute.AreaName);
            }

            if (controllerDescriptor.ControllerType.Namespace != null)
            {
                return(controllerDescriptor.ControllerType.Namespace.Split('.').Last());
            }

            return(null);
        }
Esempio n. 2
0
 protected override System.Web.Mvc.ActionDescriptor FindAction(System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ControllerDescriptor controllerDescriptor, string actionName)
 {
     controllerContext.Controller.ViewData["TestActionInvoker"] = testService.Hello();
     return(base.FindAction(controllerContext, controllerDescriptor, actionName));
 }