public void RegisterProduct(ProductId Id, IEnumerable<FareZone> FareZones) { Guard.Against<TooManyFareZonesException>(FareZones.Count() > 3); Guard.Against<DuplicateProductIdException>(Queries.IdExists(Id)); if (Id == ProductId.Empty) Id = ProductIdGenerator.Next(); Changes.ProductRegistered(Id); }
public void RegisterSubscription(ProductId Id, IEnumerable<FareZone> FareZones, PaymentSchedule Schedule) { Guard.With<PaymentScheduleRequiredException>(Schedule != PaymentSchedule.Empty); RegisterProduct(Id, FareZones); }
bool IQueryACatalog.IdExists(ProductId Id) { return RegisteredProductIds.Contains(Id); }
void IChangeACatalog.ProductRegistered(ProductId Id) { RegisteredProductIds.Add(Id); }