/// <summary> /// Updates the product stock. /// </summary> /// <param name="stockInfo">The stock info.</param> /// <param name="newAmount">The new amount.</param> public void Update(ProductStockInfo stockInfo, long newAmount) { ServiceClientArgs args = this.serviceClientArgsFactory.GetServiceClientArgs(); using (ProductStockServiceClient client = new ProductStockServiceClient()) { client.Update(stockInfo.ProductCode, newAmount, args); } }
/// <summary> /// Updates the specified stock info. /// </summary> /// <param name="stockInfo">The stock info.</param> /// <param name="expression">The expression.</param> public void Update(ProductStockInfo stockInfo, Expression <Func <long, long> > expression) { Func <long, long> func = expression.Compile(); ServiceClientArgs args = this.serviceClientArgsFactory.GetServiceClientArgs(); using (ProductStockServiceClient client = new ProductStockServiceClient()) { ProductStock stock = client.Get(stockInfo, args); long newStock = func(stock.Stock); client.Update(stockInfo.ProductCode, newStock, args); } }
/// <summary> /// Updates the specified stock info. /// </summary> /// <param name="stockInfo">The stock info.</param> /// <param name="expression">The expression.</param> public void Update(ProductStockInfo stockInfo, Expression<Func<long, long>> expression) { Func<long, long> func = expression.Compile(); ServiceClientArgs args = this.serviceClientArgsFactory.GetServiceClientArgs(); using (ProductStockServiceClient client = new ProductStockServiceClient()) { ProductStock stock = client.Get(stockInfo, args); long newStock = func(stock.Stock); client.Update(stockInfo.ProductCode, newStock, args); } }
/// <summary> /// Updates the product stock. /// </summary> /// <param name="stockInfo">The stock info.</param> /// <param name="newAmount">The new amount.</param> public void Update(ProductStockInfo stockInfo, long newAmount) { ServiceClientArgs args = this.serviceClientArgsFactory.GetServiceClientArgs(); using (ProductStockServiceClient client = new ProductStockServiceClient()) { client.Update(stockInfo.ProductCode, newAmount, args); } }