Beispiel #1
0
 private static Value UpdateValue(Value value, LiftAddedEvent @event)
 {
     return(new Value(
                value.JourneyCount,
                value.JourneyDistance,
                value.LiftCount + 1,
                value.LiftDistance + @event.LiftDistance));
 }
Beispiel #2
0
        public void Update(LiftAddedEvent @event)
        {
            var journey          = _journeys.Get(@event.JourneyId);
            var dateOfOccurrence = journey.DateOfOccurrence;
            var key   = new Key(new Passenger(@event.PersonId), new Month(dateOfOccurrence.Year, dateOfOccurrence.Month), new Day(dateOfOccurrence.Day));
            var value = _facts.GetOrAdd(key, () => CreateValue(dateOfOccurrence));

            _facts.Set(key, UpdateValue(value, @event));
        }
        public void Replay(LiftAddedEvent @event)
        {
            var liftDistance = new Distance(@event.LiftDistance, DistanceUnit.Kilometer);
            var journey      = _repositories
                               .Get <Journey>(@event.JourneyId)
                               .AddLift(@event.PersonId, liftDistance);

            _repositories.Store(journey);
        }
Beispiel #4
0
 private static Lift ToDto(LiftAddedEvent lift)
 {
     return(new Lift(
                lift.PersonId,
                lift.LiftDistance));
 }
Beispiel #5
0
 public void Update(LiftAddedEvent @event)
 {
     _lifts.Add(@event);
 }