Example #1
0
        public FhirResponse Create(string type, Resource resource)
        {
            Key key = Key.Create(type, resource?.Id);

            if (Request.Headers.ContainsKey(FhirHttpHeaders.IfNoneExist))
            {
                NameValueCollection searchQueryString = HttpUtility.ParseQueryString(Request.GetTypedHeaders().IfNoneExist());
                IEnumerable <Tuple <string, string> > searchValues =
                    searchQueryString.Keys.Cast <string>()
                    .Select(k => new Tuple <string, string>(k, searchQueryString[k]));

                return(_fhirService.ConditionalCreate(key, resource, SearchParams.FromUriParamList(searchValues)));
            }

            return(_fhirService.Create(key, resource));
        }
        public ServerFhirResponse Create(string type, Resource resource)
        {
            Key key = Key.Create(type, resource?.Id);

            if (HttpHeaderUtil.Exists(Request.Headers, FhirHttpHeaders.IfNoneExist))
            {
                NameValueCollection searchQueryString =
                    HttpUtility.ParseQueryString(
                        Request.Headers.First(h => h.Key == FhirHttpHeaders.IfNoneExist).Value.Single());

                IEnumerable <Tuple <string, string> > searchValues =
                    searchQueryString.Keys.Cast <string>()
                    .Select(k => new Tuple <string, string>(k, searchQueryString[k]));


                return(fhirService.ConditionalCreate(key, resource, SearchParams.FromUriParamList(searchValues)));
            }

            return(fhirService.Create(key, resource));
        }
Example #3
0
        public FhirResponse Create(string type, Resource resource)
        {
            Key key = Key.Create(type, resource?.Id);

            if (Request.Headers.Exists(FhirHttpHeaders.IfNoneExist))
            {
                NameValueCollection searchQueryString =
                    HttpUtility.ParseQueryString(
                        Request.Headers.First(h => h.Key == FhirHttpHeaders.IfNoneExist).Value.Single());
                IEnumerable <Tuple <string, string> > searchValues =
                    searchQueryString.Keys.Cast <string>()
                    .Select(k => new Tuple <string, string>(k, searchQueryString[k]));


                return(_fhirService.ConditionalCreate(key, resource, SearchParams.FromUriParamList(searchValues)));
            }

            //entry.Tags = Request.GetFhirTags(); // todo: move to model binder?

            return(_fhirService.Create(key, resource));
        }