コード例 #1
0
ファイル: TestRestUrl.cs プロジェクト: wdebeau1/fhir-net-api
        public void Query()
        {
            RestUrl endpoint = new RestUrl("http://localhost/fhir");
            RestUrl resturi;
            
            resturi = endpoint.Search("organization").AddParam("family", "Johnson").AddParam("given", "William");
            Assert.AreEqual("http://localhost/fhir/organization/_search?family=Johnson&given=William", resturi.AsString);

            var rl2 = new RestUrl(resturi.Uri);

            rl2.AddParam("given","Piet");
            Assert.AreEqual("http://localhost/fhir/organization/_search?family=Johnson&given=William&given=Piet", rl2.AsString);
        }
コード例 #2
0
        public static RestUrl Search(this RestUrl url, Query q)
        {
            // The ResourceType is the only parameter that needs special handling,
            // since the others are all "normal" parameters. Just make sure we don't
            // include the special _type parameter on the REST url
            var result = url.Search(q.ResourceType);

            foreach (var par in q.Parameter)
            {
                var paramKey = Query.ExtractParamKey(par);
                if (paramKey != Query.SEARCH_PARAM_TYPE)
                {
                    result.AddParam(Query.ExtractParamKey(par),
                                    Query.ExtractParamValue(par));
                }
            }

            return(result);
        }