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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 private void ApplyUnitsAdded(UnitsAdded unitsAdded)
 {
     this.Units += unitsAdded.Units;
 }
Exemple #4
0
 internal void OnUnitsAdded(UnitType unit, int count) => UnitsAdded?.Invoke(unit, count);