public async Task WhenAsync(MergePatchSupplierProductDto c)
        {
            var idObj         = SupplierProductProxyUtils.ToIdString((c as IMergePatchSupplierProduct).SupplierProductId);
            var uriParameters = new SupplierProductUriParameters();

            uriParameters.Id = idObj;

            var req  = new SupplierProductPatchRequest(uriParameters, (MergePatchSupplierProductDto)c);
            var resp = await _ramlClient.SupplierProduct.Patch(req);

            SupplierProductProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async Task <ISupplierProductEvent> GetStateEventAsync(SupplierProductId supplierProductId, long version)
        {
            var idObj         = SupplierProductProxyUtils.ToIdString(supplierProductId);
            var uriParameters = new SupplierProductStateEventUriParameters();

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

            var req  = new SupplierProductStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.SupplierProductStateEvent.Get(req);

            SupplierProductProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <ISupplierProductState> GetHistoryStateAsync(SupplierProductId supplierProductId, long version)
        {
            var idObj         = SupplierProductProxyUtils.ToIdString(supplierProductId);
            var uriParameters = new SupplierProductHistoryStateUriParameters();

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

            var req  = new SupplierProductHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.SupplierProductHistoryState.Get(req);

            SupplierProductProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToSupplierProductState());
        }
        public async Task <ISupplierProductState> GetAsync(SupplierProductId supplierProductId)
        {
            ISupplierProductState state = null;
            var idObj         = SupplierProductProxyUtils.ToIdString(supplierProductId);
            var uriParameters = new SupplierProductUriParameters();

            uriParameters.Id = idObj;

            var req = new SupplierProductGetRequest(uriParameters);

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

            SupplierProductProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToSupplierProductState();
            return(state);
        }
        public async Task WhenAsync(DeleteSupplierProductDto c)
        {
            var idObj         = SupplierProductProxyUtils.ToIdString((c as IDeleteSupplierProduct).SupplierProductId);
            var uriParameters = new SupplierProductUriParameters();

            uriParameters.Id = idObj;

            var q = new SupplierProductDeleteQuery();

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

            var req = new SupplierProductDeleteRequest(uriParameters);

            req.Query = q;

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

            SupplierProductProxyUtils.ThrowOnHttpResponseError(resp);
        }