示例#1
0
        public async Task <Bundle> SearchByPost(string ResourceName)
        {
            System.Diagnostics.Debug.WriteLine("GET: " + this.Request.GetDisplayUrl());

            var parameters = Request.TupledParameters(true).ToList();

            Hl7.Fhir.Rest.SummaryType summary = GetSummaryParameter(Request);
            string sortby   = Request.GetParameter(FhirParameter.SORT);
            int    pagesize = Request.GetIntParameter(FhirParameter.COUNT) ?? Const.DEFAULT_PAGE_SIZE;

            var buri = this.CalculateBaseURI("{ResourceName}");

            IFhirResourceServiceSTU3 model = GetResourceModel(ResourceName, GetInputs(buri));

            // Also grab the application/x-www-form-urlencoded content body
            if (Request.HasFormContentType)
            {
                var requestData = Request.Form;
                foreach (var item in requestData)
                {
                    parameters.Add(new KeyValuePair <string, string>(item.Key, item.Value));
                }
            }

            Bundle result = await model.Search(parameters, pagesize, summary);

            result.ResourceBase = new Uri(buri);

            // this.Request.SaveEntry(result);
            return(result);
        }
示例#2
0
        public Bundle SearchByPost(string ResourceName)
        {
            System.Diagnostics.Trace.WriteLine("POST: " + this.ControllerContext.Request.RequestUri.OriginalString);

            var parameters = Request.TupledParameters(true).ToList();

            Hl7.Fhir.Rest.SummaryType summary = GetSummaryParameter(Request);
            string sortby   = Request.GetParameter(FhirParameter.SORT);
            int    pagesize = Request.GetIntParameter(FhirParameter.COUNT) ?? Const.DEFAULT_PAGE_SIZE;

            var buri = this.CalculateBaseURI("{ResourceName}");

            IFhirResourceServiceSTU3 model = GetResourceModel(ResourceName, GetInputs(buri));

            // Also grab the application/x-www-form-urlencoded content body
            if (Request.Content.IsFormData())
            {
                // This is Bad, talk to Andrew again to find out the library to assist with this.
                var requestData = Request.Content.ReadAsFormDataAsync().Result;
                foreach (var item in requestData.AllKeys)
                {
                    parameters.Add(new KeyValuePair <string, string>(item, requestData[item]));
                }
            }

            Bundle result = model.Search(parameters, pagesize, summary);

            result.ResourceBase = new Uri(buri);

            this.ControllerContext.Request.SaveEntry(result);
            return(result);
        }
示例#3
0
        public Bundle Search(string ResourceName)
        {
            try
            {
                System.Diagnostics.Trace.WriteLine("GET: " + this.ControllerContext.Request.RequestUri.OriginalString);

                var parameters = Request.TupledParameters(true);
                Hl7.Fhir.Rest.SummaryType summary = GetSummaryParameter(Request);
                string sortby        = Request.GetParameter(FhirParameter.SORT);
                int    pagesize      = Request.GetIntParameter(FhirParameter.COUNT) ?? Const.DEFAULT_PAGE_SIZE;
                var    includeParams = Request.TupledParameters(false).Where(i => i.Key == "_include");

                var buri = this.CalculateBaseURI("{ResourceName}");
                parameters = parameters.Union(includeParams);

                IFhirResourceServiceSTU3 model = GetResourceModel(ResourceName, GetInputs(buri));

                Bundle result = model.Search(parameters, pagesize, summary);
                result.ResourceBase = new Uri(buri);

                this.ControllerContext.Request.SaveEntry(result);
                return(result);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.ToString());
                throw;
            }
        }
示例#4
0
        public async Task <Bundle> Search(string ResourceName)
        {
            System.Diagnostics.Debug.WriteLine("GET: " + this.Request.GetDisplayUrl());

            var parameters = Request.TupledParameters(true);

            Hl7.Fhir.Rest.SummaryType summary = GetSummaryParameter(Request);
            string sortby        = Request.GetParameter(FhirParameter.SORT);
            int    pagesize      = Request.GetIntParameter(FhirParameter.COUNT) ?? Const.DEFAULT_PAGE_SIZE;
            var    includeParams = Request.TupledParameters(false).Where(i => i.Key == "_include");

            var buri = this.CalculateBaseURI("{ResourceName}");

            parameters = parameters.Union(includeParams);

            IFhirResourceServiceSTU3 model = GetResourceModel(ResourceName, GetInputs(buri));

            Bundle result = await model.Search(parameters, pagesize, summary);

            result.ResourceBase = new Uri(buri);

            // this.Request.SaveEntry(result);
            return(result);
        }