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