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

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

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

            DamageHandlingMethodProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToDamageHandlingMethodState());
            return(states);
        }
示例#2
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new DamageHandlingMethodsCountGetQuery();

            q.Filter = DamageHandlingMethodProxyUtils.GetFilterQueryValueString(filter);
            var req = new DamageHandlingMethodsCountGetRequest();

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

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