public bool HasRouteToPath(string path, out RequestRoute resultRoute) { string candidateControllerName; var pathParts = path.TrimStart('/').Split('/'); if (pathParts[0] != string.Empty) { candidateControllerName = pathParts[0]; } else if (HasDefaultControllerName) { candidateControllerName = DefaultControllerName; } else { resultRoute = null; return false; } foreach (Route route in Routes) { if (route.ControllerName == candidateControllerName) { string methodName; if (!TryFindMethod(route, pathParts, out methodName)) break; resultRoute = new RequestRoute(route, methodName); return true; } } resultRoute = null; return false; }
public bool HasRouteToPath(string path, out RequestRoute resultRoute) { string candidateControllerName; var pathParts = path.TrimStart('/').Split('/'); if (pathParts[0] != string.Empty) { candidateControllerName = pathParts[0]; } else if (HasDefaultControllerName) { candidateControllerName = DefaultControllerName; } else { resultRoute = null; return(false); } foreach (Route route in Routes) { if (route.ControllerName == candidateControllerName) { string methodName; if (!TryFindMethod(route, pathParts, out methodName)) { break; } resultRoute = new RequestRoute(route, methodName); return(true); } } resultRoute = null; return(false); }