コード例 #1
0
        public async Task <IEnumerable <IAttributeSetInstanceExtensionFieldState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IAttributeSetInstanceExtensionFieldState> states = null;
            var q = new AttributeSetInstanceExtensionFieldsGetQuery();

            q.FirstResult = firstResult;
            q.MaxResults  = maxResults;
            q.Sort        = AttributeSetInstanceExtensionFieldProxyUtils.GetOrdersQueryValueString(orders);
            q.Fields      = AttributeSetInstanceExtensionFieldProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator);
            q.Filter      = AttributeSetInstanceExtensionFieldProxyUtils.GetFilterQueryValueString(filter);
            var req = new AttributeSetInstanceExtensionFieldsGetRequest();

            req.Query = q;
            var resp = await _ramlClient.AttributeSetInstanceExtensionFields.Get(req);

            AttributeSetInstanceExtensionFieldProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToAttributeSetInstanceExtensionFieldState());
            return(states);
        }
コード例 #2
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new AttributeSetInstanceExtensionFieldsCountGetQuery();

            q.Filter = AttributeSetInstanceExtensionFieldProxyUtils.GetFilterQueryValueString(filter);
            var req = new AttributeSetInstanceExtensionFieldsCountGetRequest();

            req.Query = q;
            var resp = await _ramlClient.AttributeSetInstanceExtensionFieldsCount.Get(req);

            AttributeSetInstanceExtensionFieldProxyUtils.ThrowOnHttpResponseError(resp);
            string str = await resp.RawContent.ReadAsStringAsync();

            if (str.StartsWith("\""))
            {
                str = str.Substring(1);
            }
            if (str.EndsWith("\""))
            {
                str = str.Substring(0, str.Length - 1);
            }
            return(long.Parse(str));
        }