public async Task <IEnumerable <IUomState> > GetAsync(IEnumerable <KeyValuePair <string, object> > filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null) { IEnumerable <IUomState> states = null; var q = new UomsGetQuery(); q.FirstResult = firstResult; q.MaxResults = maxResults; q.Sort = UomProxyUtils.GetOrdersQueryValueString(orders); q.Fields = UomProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator); q.FilterTag = UomProxyUtils.GetFilterTagQueryValueString(filter); var req = new UomsGetRequest(); req.Query = q; var resp = await _ramlClient.Uoms.Get(req); UomProxyUtils.ThrowOnHttpResponseError(resp); states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToUomState()); return(states); }
public async virtual Task <long> GetCountAsync(IEnumerable <KeyValuePair <string, object> > filter) { var q = new UomsCountGetQuery(); q.FilterTag = UomProxyUtils.GetFilterTagQueryValueString(filter); var req = new UomsCountGetRequest(); req.Query = q; var resp = await _ramlClient.UomsCount.Get(req); UomProxyUtils.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)); }