public async Task WhenAsync(MergePatchPhysicalInventoryLineMvoDto c)
        {
            var idObj         = PhysicalInventoryLineMvoProxyUtils.ToIdString((c as IMergePatchPhysicalInventoryLineMvo).PhysicalInventoryLineId);
            var uriParameters = new PhysicalInventoryLineMvoUriParameters();

            uriParameters.Id = idObj;

            var req  = new PhysicalInventoryLineMvoPatchRequest(uriParameters, (MergePatchPhysicalInventoryLineMvoDto)c);
            var resp = await _ramlClient.PhysicalInventoryLineMvo.Patch(req);

            PhysicalInventoryLineMvoProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async Task <IPhysicalInventoryLineMvoState> GetHistoryStateAsync(PhysicalInventoryLineId physicalInventoryLineId, long version)
        {
            var idObj         = PhysicalInventoryLineMvoProxyUtils.ToIdString(physicalInventoryLineId);
            var uriParameters = new PhysicalInventoryLineMvoHistoryStateUriParameters();

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

            var req  = new PhysicalInventoryLineMvoHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.PhysicalInventoryLineMvoHistoryState.Get(req);

            PhysicalInventoryLineMvoProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToPhysicalInventoryLineMvoState());
        }
        public async Task <IPhysicalInventoryLineMvoEvent> GetStateEventAsync(PhysicalInventoryLineId physicalInventoryLineId, long version)
        {
            var idObj         = PhysicalInventoryLineMvoProxyUtils.ToIdString(physicalInventoryLineId);
            var uriParameters = new PhysicalInventoryLineMvoStateEventUriParameters();

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

            var req  = new PhysicalInventoryLineMvoStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.PhysicalInventoryLineMvoStateEvent.Get(req);

            PhysicalInventoryLineMvoProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <IPhysicalInventoryLineMvoState> GetAsync(PhysicalInventoryLineId physicalInventoryLineId)
        {
            IPhysicalInventoryLineMvoState state = null;
            var idObj         = PhysicalInventoryLineMvoProxyUtils.ToIdString(physicalInventoryLineId);
            var uriParameters = new PhysicalInventoryLineMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new PhysicalInventoryLineMvoGetRequest(uriParameters);

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

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

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

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

            PhysicalInventoryLineMvoProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToPhysicalInventoryLineMvoState());
            return(states);
        }
        public async Task WhenAsync(DeletePhysicalInventoryLineMvoDto c)
        {
            var idObj         = PhysicalInventoryLineMvoProxyUtils.ToIdString((c as IDeletePhysicalInventoryLineMvo).PhysicalInventoryLineId);
            var uriParameters = new PhysicalInventoryLineMvoUriParameters();

            uriParameters.Id = idObj;

            var q = new PhysicalInventoryLineMvoDeleteQuery();

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

            var req = new PhysicalInventoryLineMvoDeleteRequest(uriParameters);

            req.Query = q;

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

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

            q.Filter = PhysicalInventoryLineMvoProxyUtils.GetFilterQueryValueString(filter);
            var req = new PhysicalInventoryLineMvosCountGetRequest();

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

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