public void Handle(UnitsAdded @event) { var itemView = this.readModelRepository.Get <ItemView>().Single(x => x.Id.Value == @event.Id); itemView.Units += @event.Units; itemView.AddHistoryRow($"{@event.Horodate:G} - Add {@event.Units} unit(s)."); this.readModelRepository.Update(itemView); }
public void AddUnits(uint units) { if (this.IsDisabled()) { throw new DomainException("You can't add units to a disabled item."); } var @event = new UnitsAdded(this.Id, units); this.UncommitedEventsList.Add(@event); this.ApplyUnitsAdded(@event); }
private void ApplyUnitsAdded(UnitsAdded unitsAdded) { this.Units += unitsAdded.Units; }
internal void OnUnitsAdded(UnitType unit, int count) => UnitsAdded?.Invoke(unit, count);