public async Task WhenAsync(MergePatchMovementConfirmationLineMvoDto c)
        {
            var idObj         = MovementConfirmationLineMvoProxyUtils.ToIdString((c as IMergePatchMovementConfirmationLineMvo).MovementConfirmationLineId);
            var uriParameters = new MovementConfirmationLineMvoUriParameters();

            uriParameters.Id = idObj;

            var req  = new MovementConfirmationLineMvoPatchRequest(uriParameters, (MergePatchMovementConfirmationLineMvoDto)c);
            var resp = await _ramlClient.MovementConfirmationLineMvo.Patch(req);

            MovementConfirmationLineMvoProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async Task <IMovementConfirmationLineMvoState> GetHistoryStateAsync(MovementConfirmationLineId movementConfirmationLineId, long version)
        {
            var idObj         = MovementConfirmationLineMvoProxyUtils.ToIdString(movementConfirmationLineId);
            var uriParameters = new MovementConfirmationLineMvoHistoryStateUriParameters();

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

            var req  = new MovementConfirmationLineMvoHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.MovementConfirmationLineMvoHistoryState.Get(req);

            MovementConfirmationLineMvoProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToMovementConfirmationLineMvoState());
        }
        public async Task <IMovementConfirmationLineMvoEvent> GetStateEventAsync(MovementConfirmationLineId movementConfirmationLineId, long version)
        {
            var idObj         = MovementConfirmationLineMvoProxyUtils.ToIdString(movementConfirmationLineId);
            var uriParameters = new MovementConfirmationLineMvoStateEventUriParameters();

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

            var req  = new MovementConfirmationLineMvoStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.MovementConfirmationLineMvoStateEvent.Get(req);

            MovementConfirmationLineMvoProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <IMovementConfirmationLineMvoState> GetAsync(MovementConfirmationLineId movementConfirmationLineId)
        {
            IMovementConfirmationLineMvoState state = null;
            var idObj         = MovementConfirmationLineMvoProxyUtils.ToIdString(movementConfirmationLineId);
            var uriParameters = new MovementConfirmationLineMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new MovementConfirmationLineMvoGetRequest(uriParameters);

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

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

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

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

            MovementConfirmationLineMvoProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToMovementConfirmationLineMvoState());
            return(states);
        }
        public async Task WhenAsync(DeleteMovementConfirmationLineMvoDto c)
        {
            var idObj         = MovementConfirmationLineMvoProxyUtils.ToIdString((c as IDeleteMovementConfirmationLineMvo).MovementConfirmationLineId);
            var uriParameters = new MovementConfirmationLineMvoUriParameters();

            uriParameters.Id = idObj;

            var q = new MovementConfirmationLineMvoDeleteQuery();

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

            var req = new MovementConfirmationLineMvoDeleteRequest(uriParameters);

            req.Query = q;

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

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

            q.Filter = MovementConfirmationLineMvoProxyUtils.GetFilterQueryValueString(filter);
            var req = new MovementConfirmationLineMvosCountGetRequest();

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

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