public async Task WhenAsync(MergePatchAttributeAliasMvoDto c)
        {
            var idObj         = AttributeAliasMvoProxyUtils.ToIdString((c as IMergePatchAttributeAliasMvo).AttributeAliasId);
            var uriParameters = new AttributeAliasMvoUriParameters();

            uriParameters.Id = idObj;

            var req  = new AttributeAliasMvoPatchRequest(uriParameters, (MergePatchAttributeAliasMvoDto)c);
            var resp = await _ramlClient.AttributeAliasMvo.Patch(req);

            AttributeAliasMvoProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async Task <IAttributeAliasMvoState> GetHistoryStateAsync(AttributeAliasId attributeAliasId, long version)
        {
            var idObj         = AttributeAliasMvoProxyUtils.ToIdString(attributeAliasId);
            var uriParameters = new AttributeAliasMvoHistoryStateUriParameters();

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

            var req  = new AttributeAliasMvoHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.AttributeAliasMvoHistoryState.Get(req);

            AttributeAliasMvoProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToAttributeAliasMvoState());
        }
        public async Task <IAttributeAliasMvoEvent> GetStateEventAsync(AttributeAliasId attributeAliasId, long version)
        {
            var idObj         = AttributeAliasMvoProxyUtils.ToIdString(attributeAliasId);
            var uriParameters = new AttributeAliasMvoStateEventUriParameters();

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

            var req  = new AttributeAliasMvoStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.AttributeAliasMvoStateEvent.Get(req);

            AttributeAliasMvoProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <IAttributeAliasMvoState> GetAsync(AttributeAliasId attributeAliasId)
        {
            IAttributeAliasMvoState state = null;
            var idObj         = AttributeAliasMvoProxyUtils.ToIdString(attributeAliasId);
            var uriParameters = new AttributeAliasMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new AttributeAliasMvoGetRequest(uriParameters);

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

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

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

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

            AttributeAliasMvoProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToAttributeAliasMvoState());
            return(states);
        }
        public async Task WhenAsync(DeleteAttributeAliasMvoDto c)
        {
            var idObj         = AttributeAliasMvoProxyUtils.ToIdString((c as IDeleteAttributeAliasMvo).AttributeAliasId);
            var uriParameters = new AttributeAliasMvoUriParameters();

            uriParameters.Id = idObj;

            var q = new AttributeAliasMvoDeleteQuery();

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

            var req = new AttributeAliasMvoDeleteRequest(uriParameters);

            req.Query = q;

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

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

            q.Filter = AttributeAliasMvoProxyUtils.GetFilterQueryValueString(filter);
            var req = new AttributeAliasMvosCountGetRequest();

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

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