public ActionItem(ControllerItem controller, MethodInfo action) { SetName(action); SetPath(controller); SetMethod(action); SetAttributes(action); }
private void SetPath(ControllerItem controller) { object routeAttribute = controller.Attributes.FirstOrDefault(x => x.GetType() == typeof(RouteAttribute)); var controllerName = ""; if (routeAttribute != null) { controllerName = ((RouteAttribute)routeAttribute).Template; } else { controllerName = controller.Name; } controllerName = controllerName.Replace("[controller]", controller.Name.Replace("Controller", "").ToLower()); controllerName = $"{controllerName}/{Name}"; Path = controllerName; }