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)); }
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); }
public void Apply(ItemDisabled evt) { Disabled = true; }
private void OnDisable() { ItemDisabled?.Invoke(this); _selectionButton.onClick.RemoveListener(OnSelectionButtonClick); }