コード例 #1
0
        public void AddStock(JuiceStockInfo juiceStockInfo)
        {
            var stock = GetStock(juiceStockInfo);

            if (stock != null)
            {
                stock.Count += juiceStockInfo.Count;
                stock.Price = juiceStockInfo.Price;
            }
            else
            {
                _juiceStockInfoCollection.Add(juiceStockInfo);
            }
        }
コード例 #2
0
 private JuiceStockInfo GetStock(JuiceStockInfo stockInfo)
 {
     return _juiceStockInfoCollection
         .FirstOrDefault(info =>
                         info.Name == stockInfo.Name);
 }