Exemplo n.º 1
0
 public void AddItem(Product product, int qty)
 {
     if (_state.CanAddProduct())
     {
         if (!OrderContains(product))
         {
             _items.Add(OrderItemFactory.CreateItemFor(product, this, qty));
         }
     }
     else
     {
         throw new CannotAmendOrderException(String.Format("You cannot add an item to an order with the status of '{0}'.", Status.ToString()));
     }
 }
Exemplo n.º 2
0
 public void AddItem(Product product, int qty)
 {
     if (_state.CanAddProduct())
     {
         if (!OrderContains(product))
         {
             _items.Add(OrderItemFactory.CreateItemFor(product, this, qty));
         }
     }
     else
     {
         throw new CannotAmendOrderException(String.Format(OrderBusinessRulesMessages.CanNotAddItemToOrder, Status));
     }
 }