Beispiel #1
0
 public static CarState.Result AddCarItem(CarState state, CarItemId carItemId, string desc, ICarPolicy carPolicy) =>
 state.With(s => carPolicy.Apply(new CannotBeAddedMoreThanTwoItems(s)))
 .ApplyEvent(new CarItemAddedEvent(state.Id, carItemId, desc));
Beispiel #2
0
 public static CarState.Result RenewModel(CarState state, int year, ICarPolicy carPolicy) =>
 state.With(s => carPolicy.Apply(new ModelYearCannotBeAboveThan(year)))
 .ApplyEvent(new CarModelRenewedEvent(state.Id, year));