public async Task WhenAsync(MergePatchOrderShipGroupMvoDto c)
        {
            var idObj         = OrderShipGroupMvoProxyUtils.ToIdString((c as IMergePatchOrderShipGroupMvo).OrderShipGroupId);
            var uriParameters = new OrderShipGroupMvoUriParameters();

            uriParameters.Id = idObj;

            var req  = new OrderShipGroupMvoPatchRequest(uriParameters, (MergePatchOrderShipGroupMvoDto)c);
            var resp = await _ramlClient.OrderShipGroupMvo.Patch(req);

            OrderShipGroupMvoProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async Task <IOrderShipGroupMvoState> GetHistoryStateAsync(OrderShipGroupId orderShipGroupId, long version)
        {
            var idObj         = OrderShipGroupMvoProxyUtils.ToIdString(orderShipGroupId);
            var uriParameters = new OrderShipGroupMvoHistoryStateUriParameters();

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

            var req  = new OrderShipGroupMvoHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.OrderShipGroupMvoHistoryState.Get(req);

            OrderShipGroupMvoProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToOrderShipGroupMvoState());
        }
        public async Task <IOrderShipGroupMvoEvent> GetStateEventAsync(OrderShipGroupId orderShipGroupId, long version)
        {
            var idObj         = OrderShipGroupMvoProxyUtils.ToIdString(orderShipGroupId);
            var uriParameters = new OrderShipGroupMvoStateEventUriParameters();

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

            var req  = new OrderShipGroupMvoStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.OrderShipGroupMvoStateEvent.Get(req);

            OrderShipGroupMvoProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <IOrderShipGroupMvoState> GetAsync(OrderShipGroupId orderShipGroupId)
        {
            IOrderShipGroupMvoState state = null;
            var idObj         = OrderShipGroupMvoProxyUtils.ToIdString(orderShipGroupId);
            var uriParameters = new OrderShipGroupMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new OrderShipGroupMvoGetRequest(uriParameters);

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

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

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

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

            OrderShipGroupMvoProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToOrderShipGroupMvoState());
            return(states);
        }
        public async Task WhenAsync(DeleteOrderShipGroupMvoDto c)
        {
            var idObj         = OrderShipGroupMvoProxyUtils.ToIdString((c as IDeleteOrderShipGroupMvo).OrderShipGroupId);
            var uriParameters = new OrderShipGroupMvoUriParameters();

            uriParameters.Id = idObj;

            var q = new OrderShipGroupMvoDeleteQuery();

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

            var req = new OrderShipGroupMvoDeleteRequest(uriParameters);

            req.Query = q;

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

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

            q.Filter = OrderShipGroupMvoProxyUtils.GetFilterQueryValueString(filter);
            var req = new OrderShipGroupMvosCountGetRequest();

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

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