public async Task WhenAsync(MergePatchShipmentItemMvoDto c)
        {
            var idObj         = ShipmentItemMvoProxyUtils.ToIdString((c as IMergePatchShipmentItemMvo).ShipmentItemId);
            var uriParameters = new ShipmentItemMvoUriParameters();

            uriParameters.Id = idObj;

            var req  = new ShipmentItemMvoPatchRequest(uriParameters, (MergePatchShipmentItemMvoDto)c);
            var resp = await _ramlClient.ShipmentItemMvo.Patch(req);

            ShipmentItemMvoProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async Task <IShipmentItemMvoState> GetHistoryStateAsync(ShipmentItemId shipmentItemId, long version)
        {
            var idObj         = ShipmentItemMvoProxyUtils.ToIdString(shipmentItemId);
            var uriParameters = new ShipmentItemMvoHistoryStateUriParameters();

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

            var req  = new ShipmentItemMvoHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.ShipmentItemMvoHistoryState.Get(req);

            ShipmentItemMvoProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToShipmentItemMvoState());
        }
        public async Task <IShipmentItemMvoEvent> GetStateEventAsync(ShipmentItemId shipmentItemId, long version)
        {
            var idObj         = ShipmentItemMvoProxyUtils.ToIdString(shipmentItemId);
            var uriParameters = new ShipmentItemMvoStateEventUriParameters();

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

            var req  = new ShipmentItemMvoStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.ShipmentItemMvoStateEvent.Get(req);

            ShipmentItemMvoProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <IShipmentItemMvoState> GetAsync(ShipmentItemId shipmentItemId)
        {
            IShipmentItemMvoState state = null;
            var idObj         = ShipmentItemMvoProxyUtils.ToIdString(shipmentItemId);
            var uriParameters = new ShipmentItemMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new ShipmentItemMvoGetRequest(uriParameters);

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

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

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

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

            ShipmentItemMvoProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToShipmentItemMvoState());
            return(states);
        }
        public async Task WhenAsync(DeleteShipmentItemMvoDto c)
        {
            var idObj         = ShipmentItemMvoProxyUtils.ToIdString((c as IDeleteShipmentItemMvo).ShipmentItemId);
            var uriParameters = new ShipmentItemMvoUriParameters();

            uriParameters.Id = idObj;

            var q = new ShipmentItemMvoDeleteQuery();

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

            var req = new ShipmentItemMvoDeleteRequest(uriParameters);

            req.Query = q;

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

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

            q.Filter = ShipmentItemMvoProxyUtils.GetFilterQueryValueString(filter);
            var req = new ShipmentItemMvosCountGetRequest();

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

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