Exemplo n.º 1
0
        public IEnumerable<Event> Handle(CreateInventoryItem cmd)
        {
            if (string.IsNullOrEmpty(cmd.Name))
                throw new ArgumentException("Inventory item name cannot be null or empty");

            if (name != null)
                throw new InvalidOperationException(
                    string.Format("Inventory item with id {0} has been already created", Id));

            yield return new InventoryItemCreated(cmd.Name);
        }
 public void Handle(CreateInventoryItem message)
 {
     var item = new InventoryItem(message.InventoryItemId, message.Name);
     _repository.Save(item, -1);
 }