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); }
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)); }