Esempio n. 1
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new AttributesCountGetQuery();

            q.Filter = AttributeProxyUtils.GetFilterQueryValueString(filter);
            var req = new AttributesCountGetRequest();

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

            AttributeProxyUtils.ThrowOnHttpResponseError(resp);
            return(long.Parse(await resp.RawContent.ReadAsStringAsync()));
        }
Esempio n. 2
0
        public async Task <IEnumerable <IAttributeState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IAttributeState> states = null;
            var q = new AttributesGetQuery();

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

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

            AttributeProxyUtils.ThrowOnHttpResponseError(resp);
            states = resp.Content;
            return(states);
        }
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new AttributesCountGetQuery();

            q.Filter = AttributeProxyUtils.GetFilterQueryValueString(filter);
            var req = new AttributesCountGetRequest();

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

            AttributeProxyUtils.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));
        }