Beispiel #1
0
        public void AddItem(Guid productId, int quantity)
        {
            var orderItem = OrderedItems.SingleOrDefault(o => o.ProductId == productId && o.OrderId == Id);

            if (orderItem == null)
            {
                orderItem = new OrderedItem()
                {
                    ProductId = productId, OrderId = Id, Quantity = quantity
                }
            }
            ;
            else
            {
                orderItem.Quantity += quantity;
            }
            OrderedItems.Add(orderItem);
        }
Beispiel #2
0
 public void PlaceOrder(OrderPlacedEvent items)
 {
     items.Items.ForEach(x => OrderedItems.Add(x));
 }