Example #1
0
 public InventoryItem(ProductId productId, int quantity, decimal price)
 {
     this.ProductId = productId;
     this.Quantity  = quantity;
     this.Price     = price;
 }
Example #2
0
 private InventoryItem GetProduct(ProductId productId)
 {
     return(this.items.Single(i => i.ProductId == productId));
 }
Example #3
0
 public void Reserve(ProductId productId, int quantity)
 {
     GetProduct(productId).ReservedCount = quantity;
 }
Example #4
0
 public decimal PriceFor(ProductId productId)
 {
     return(GetProduct(productId).Price);
 }
Example #5
0
 public bool CheckAvailability(ProductId productId, int quantity)
 {
     return(AvailableQuantity(productId) >= quantity);
 }
Example #6
0
 public void Add(ProductId productId, int quantity, decimal price)
 {
     this.items.Add(new InventoryItem(productId, quantity, price));
 }