// POST api/values public void Post(SAPProduct product) { SAPConnector server = new SAPConnector(); bool result = server.UpdateProduct(product); }
public bool UpdateProduct(SAPProduct product) { try { var service = GetService(); var query = (from ZGWSAMPLE_SRV.Product p in service.ProductCollection where p.ProductId == product.ProductId select p); var updatedProduct = query.FirstOrDefault(); if (updatedProduct != null) { updatedProduct.Price = decimal.Parse(product.Price); updatedProduct.CurrencyCode = SAPProduct.getCurrency(product.Currency); service.UpdateObject(updatedProduct); service.SaveChanges(); return true; } return false; } catch (Exception ex) { Logger.Log(ex); return false; } }