public async Task WhenAsync(MergePatchSellableInventoryItemEntryMvoDto c)
        {
            var idObj         = SellableInventoryItemEntryMvoProxyUtils.ToIdString((c as IMergePatchSellableInventoryItemEntryMvo).SellableInventoryItemEntryId);
            var uriParameters = new SellableInventoryItemEntryMvoUriParameters();

            uriParameters.Id = idObj;

            var req  = new SellableInventoryItemEntryMvoPatchRequest(uriParameters, (MergePatchSellableInventoryItemEntryMvoDto)c);
            var resp = await _ramlClient.SellableInventoryItemEntryMvo.Patch(req);

            SellableInventoryItemEntryMvoProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async Task <ISellableInventoryItemEntryMvoState> GetHistoryStateAsync(SellableInventoryItemEntryId sellableInventoryItemEntryId, long version)
        {
            var idObj         = SellableInventoryItemEntryMvoProxyUtils.ToIdString(sellableInventoryItemEntryId);
            var uriParameters = new SellableInventoryItemEntryMvoHistoryStateUriParameters();

            uriParameters.Id      = idObj;
            uriParameters.Version = version.ToString();

            var req  = new SellableInventoryItemEntryMvoHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.SellableInventoryItemEntryMvoHistoryState.Get(req);

            SellableInventoryItemEntryMvoProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToSellableInventoryItemEntryMvoState());
        }
        public async Task <ISellableInventoryItemEntryMvoState> GetAsync(SellableInventoryItemEntryId sellableInventoryItemEntryId)
        {
            ISellableInventoryItemEntryMvoState state = null;
            var idObj         = SellableInventoryItemEntryMvoProxyUtils.ToIdString(sellableInventoryItemEntryId);
            var uriParameters = new SellableInventoryItemEntryMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new SellableInventoryItemEntryMvoGetRequest(uriParameters);

            var resp = await _ramlClient.SellableInventoryItemEntryMvo.Get(req);

            SellableInventoryItemEntryMvoProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToSellableInventoryItemEntryMvoState();
            return(state);
        }
        public async Task <IEnumerable <ISellableInventoryItemEntryMvoState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <ISellableInventoryItemEntryMvoState> states = null;
            var q = new SellableInventoryItemEntryMvosGetQuery();

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

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

            SellableInventoryItemEntryMvoProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToSellableInventoryItemEntryMvoState());
            return(states);
        }
        public async Task WhenAsync(DeleteSellableInventoryItemEntryMvoDto c)
        {
            var idObj         = SellableInventoryItemEntryMvoProxyUtils.ToIdString((c as IDeleteSellableInventoryItemEntryMvo).SellableInventoryItemEntryId);
            var uriParameters = new SellableInventoryItemEntryMvoUriParameters();

            uriParameters.Id = idObj;

            var q = new SellableInventoryItemEntryMvoDeleteQuery();

            q.CommandId   = c.CommandId;
            q.RequesterId = c.RequesterId;
            q.Version     = Convert.ToString(c.SellableInventoryItemVersion);

            var req = new SellableInventoryItemEntryMvoDeleteRequest(uriParameters);

            req.Query = q;

            var resp = await _ramlClient.SellableInventoryItemEntryMvo.Delete(req);

            SellableInventoryItemEntryMvoProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new SellableInventoryItemEntryMvosCountGetQuery();

            q.Filter = SellableInventoryItemEntryMvoProxyUtils.GetFilterQueryValueString(filter);
            var req = new SellableInventoryItemEntryMvosCountGetRequest();

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

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