Esempio n. 1
0
 public void Put(string id, [FromBody] Item item)
 {
     var itemAdded = new ItemAdded
         {
             AggregateId = id,
             ItemName = item.ItemName,
             Quantity = item.Quantity
         };
     _repository.StoreEvent<Order>(HardCodedTenantIdForPoc, itemAdded);
 }
Esempio n. 2
0
 private void Process(ItemAdded itemAdded)
 {
     var item = Items.Find(x => x.ItemName == itemAdded.ItemName);
     if (item != null)
     {
         item.Quantity += itemAdded.Quantity;
     }
     else
     {
         Items.Add(new Item
             {
                 ItemName = itemAdded.ItemName,
                 Quantity = itemAdded.Quantity
             });
     }
 }