Пример #1
0
 public Beer(Guid?id, string label, string description, int?stock)
 {
     Id          = new BeerId(id);
     Label       = new BeerLabel(label);
     Description = new BeerDescription(description);
     Stock       = new BeerStock(stock);
 }
Пример #2
0
        public void DecreaseStock(int stock)
        {
            var result = Stock.Value - Math.Abs(stock);

            Stock = new BeerStock(result < 0 ? 0 : result);
        }
Пример #3
0
 public void IncreaseStock(int stock)
 {
     Stock = new BeerStock(Stock.Value + Math.Abs(stock));
 }