Esempio n. 1
0
        public void Handle(ItemDisabled @event)
        {
            var itemView = this.readModelRepository.Get <ItemView>().Single(x => x.Id.Value == @event.Id);

            this.readModelRepository.Delete(itemView);
            this.readModelRepository.Insert(new DisabledItemView(itemView.Id.Value, itemView.Name));
        }
Esempio n. 2
0
        public void Disable()
        {
            if (this.IsDisabled())
            {
                throw new DomainException("You can't disable an item when it's already disable.");
            }

            if (this.Units > 0)
            {
                throw new DomainException("You can't disable an item when it's have some units.");
            }

            var @event = new ItemDisabled(this.Id);

            this.ApplyItemDisabled();
            this.UncommitedEventsList.Add(@event);
        }
Esempio n. 3
0
 public void Apply(ItemDisabled evt)
 {
     Disabled = true;
 }
Esempio n. 4
0
 private void OnDisable()
 {
     ItemDisabled?.Invoke(this);
     _selectionButton.onClick.RemoveListener(OnSelectionButtonClick);
 }