示例#1
0
        public async Task WhenAsync(MergePatchProductDto c)
        {
            var idObj         = (c as IMergePatchProduct).ProductId;
            var uriParameters = new ProductUriParameters();

            uriParameters.Id = idObj;

            var req  = new ProductPatchRequest(uriParameters, (MergePatchProductDto)c);
            var resp = await _ramlClient.Product.Patch(req);

            ProductProxyUtils.ThrowOnHttpResponseError(resp);
        }
示例#2
0
        public ActionResult PartialUpdateProduct(int id, [FromBody] ProductPatchRequest patchRequest)
        {
            if (patchRequest == null)
            {
                return(BadRequest("Product patch request cannot be null"));
            }

            var updateProductResult = productManager.UpdateProduct(id, new ProductUpdateParameters()
            {
                Description        = patchRequest.Description,
                ReplaceDescription = true
            });

            if (!updateProductResult.Success)
            {
                return(BadRequest(updateProductResult.ExceptionMessage));
            }

            return(Ok(updateProductResult.Result));
        }