Ejemplo n.º 1
0
 public KeyValuePair <R.Config.IEndPoint, Dictionary <string, string> > Route(string uri, HttpMethod httpMethod)
 {
     if (NonParametrized.ContainsKey(uri))
     {
         var res = NonParametrized[uri].Where(x => x.Method == httpMethod).FirstOrDefault();
         return(new KeyValuePair <IEndPoint, Dictionary <string, string> >(res, null));
     }
     else
     {
         string[] path            = uri.Split(new char[] { '/' });
         var      inputParameters = new Dictionary <string, string>();
         return(new KeyValuePair <R.Config.IEndPoint, Dictionary <string, string> >(GetParametrized(path, 0, Parametrized, inputParameters, httpMethod), inputParameters));
     }
 }
Ejemplo n.º 2
0
 public void Register(IRestEndPoint endPoint)
 {
     if (!endPoint.Uri.Contains("{"))
     {
         if (!NonParametrized.ContainsKey(endPoint.Uri))
         {
             NonParametrized[endPoint.Uri] = new List <IRestEndPoint>();
         }
         NonParametrized[endPoint.Uri].Add(endPoint);
     }
     else
     {
         var subPaths = endPoint.Uri.Split(new char[] { '/' });
         Register(endPoint, subPaths, 0, Parametrized);
     }
 }