Exemplo n.º 1
0
        //NOTE: Due to uri conflict, this template serves both part 7 individual and non-part7 related items.
        public void GetRelatedList(string project, string app, string resource, string id, string related, string format, int start, int limit, string sortOrder, string sortBy, string indexStyle)
        {
            try
            {
                // get list of contents is not allowed in this service
                if (string.IsNullOrEmpty(format) || !(format.ToLower() == "dto" || format.ToLower() == "rdf" ||
                                                      format.ToLower().Contains("xml") || format.ToLower().Contains("json")))
                {
                    format = "json";
                }

                NameValueCollection parameters = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters;

                bool fullIndex = false;
                if (indexStyle != null && indexStyle.ToUpper() == "FULL")
                {
                    fullIndex = true;
                }

                XDocument xDocument = _adapterProvider.GetRelatedList(project, app, resource, id, related, ref format, start, limit, sortOrder, sortBy, fullIndex, parameters);
                _adapterProvider.FormatOutgoingMessage(xDocument.Root, format);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }