public bool IsMatch(ILambdaRouteInfo routeInfo, string resource, string path, IDictionary <string, string> pathParameters,
                            IEnumerable <string> verbs)
        {
            if (routeInfo.RouteAttribute == null)
            {
                return(false);
            }
            var matchString = pathParameters.Aggregate(routeInfo.RouteAttribute.Resource, (current, parameter) => current.Replace("{" + parameter.Key + "}", parameter.Value));

            var verbMatch = routeInfo?.VerbAttribute == null
                ? true
                : !routeInfo.VerbAttribute.Verbs.Except(verbs).Any() && !verbs.Except(routeInfo.VerbAttribute.Verbs).Any();

            var isMatch = (routeInfo.RouteAttribute.Resource.Equals(resource, StringComparison.CurrentCultureIgnoreCase) ||
                           matchString.Equals(path, StringComparison.InvariantCultureIgnoreCase)) &&
                          verbMatch;

            return(isMatch);
        }
예제 #2
0
        public TResponse QuasWexExort(ILambdaRouteInfo routeInfo, object controllerInstance, object[] data)
        {
            var response = (TResponse)routeInfo?.MethodInfo.Invoke(controllerInstance, data);

            return(response);
        }
예제 #3
0
        public async Task <TResponse> QuasWexExortAsync(ILambdaRouteInfo routeInfo, object controllerInstance, object[] data)
        {
            var response = await(Task <TResponse>) routeInfo.MethodInfo.Invoke(controllerInstance, data);

            return(response);
        }