public async Task <IEnumerable <IInOutState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null) { IEnumerable <IInOutState> states = null; var q = new InOutsGetQuery(); q.FirstResult = firstResult; q.MaxResults = maxResults; q.Sort = InOutProxyUtils.GetOrdersQueryValueString(orders); q.Fields = InOutProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator); q.Filter = InOutProxyUtils.GetFilterQueryValueString(filter); var req = new InOutsGetRequest(); req.Query = q; var resp = await _ramlClient.InOuts.Get(req); InOutProxyUtils.ThrowOnHttpResponseError(resp); states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToInOutState()); return(states); }
public async virtual Task <long> GetCountAsync(ICriterion filter) { var q = new InOutsCountGetQuery(); q.Filter = InOutProxyUtils.GetFilterQueryValueString(filter); var req = new InOutsCountGetRequest(); req.Query = q; var resp = await _ramlClient.InOutsCount.Get(req); InOutProxyUtils.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)); }