public async Task WhenAsync(MergePatchGoodIdentificationTypeDto c)
        {
            var idObj         = (c as IMergePatchGoodIdentificationType).GoodIdentificationTypeId;
            var uriParameters = new GoodIdentificationTypeUriParameters();

            uriParameters.Id = idObj;

            var req  = new GoodIdentificationTypePatchRequest(uriParameters, (MergePatchGoodIdentificationTypeDto)c);
            var resp = await _ramlClient.GoodIdentificationType.Patch(req);

            GoodIdentificationTypeProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async Task <IGoodIdentificationTypeState> GetHistoryStateAsync(string goodIdentificationTypeId, long version)
        {
            var idObj         = goodIdentificationTypeId;
            var uriParameters = new GoodIdentificationTypeHistoryStateUriParameters();

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

            var req  = new GoodIdentificationTypeHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.GoodIdentificationTypeHistoryState.Get(req);

            GoodIdentificationTypeProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToGoodIdentificationTypeState());
        }
        public async Task <IGoodIdentificationTypeEvent> GetStateEventAsync(string goodIdentificationTypeId, long version)
        {
            var idObj         = goodIdentificationTypeId;
            var uriParameters = new GoodIdentificationTypeStateEventUriParameters();

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

            var req  = new GoodIdentificationTypeStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.GoodIdentificationTypeStateEvent.Get(req);

            GoodIdentificationTypeProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <IGoodIdentificationTypeState> GetAsync(string goodIdentificationTypeId)
        {
            IGoodIdentificationTypeState state = null;
            var idObj         = goodIdentificationTypeId;
            var uriParameters = new GoodIdentificationTypeUriParameters();

            uriParameters.Id = idObj;

            var req = new GoodIdentificationTypeGetRequest(uriParameters);

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

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

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

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

            GoodIdentificationTypeProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToGoodIdentificationTypeState());
            return(states);
        }
        public async Task WhenAsync(DeleteGoodIdentificationTypeDto c)
        {
            var idObj         = (c as IDeleteGoodIdentificationType).GoodIdentificationTypeId;
            var uriParameters = new GoodIdentificationTypeUriParameters();

            uriParameters.Id = idObj;

            var q = new GoodIdentificationTypeDeleteQuery();

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

            var req = new GoodIdentificationTypeDeleteRequest(uriParameters);

            req.Query = q;

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

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

            q.Filter = GoodIdentificationTypeProxyUtils.GetFilterQueryValueString(filter);
            var req = new GoodIdentificationTypesCountGetRequest();

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

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