public void UpdateSeat(Guid seatTypeId, SeatTypeInfo seatTypeInfo, int quantity) { var seatType = _seatTypes.SingleOrDefault(x => x.Id == seatTypeId); if (seatType == null) { throw new Exception("Seat type not exist."); } ApplyEvent(new SeatTypeUpdated(seatTypeId, seatTypeInfo)); if (seatType.Quantity != quantity) { var totalReservationQuantity = GetTotalReservationQuantity(seatType.Id); if (quantity < totalReservationQuantity) { throw new Exception(string.Format("Quantity cannot be small than total reservation quantity:{0}", totalReservationQuantity)); } ApplyEvent(new SeatTypeQuantityChanged(seatTypeId, quantity, quantity - totalReservationQuantity)); } }
public SeatTypeUpdated(Conference conference, Guid seatTypeId, SeatTypeInfo seatTypeInfo) : base(conference, seatTypeId, seatTypeInfo) { }
public SeatType(Guid id, SeatTypeInfo info) { Id = id; Info = info; }
public SeatTypeUpdated(Guid seatTypeId, SeatTypeInfo seatTypeInfo) : base(seatTypeId, seatTypeInfo) { }
public void AddSeat(SeatTypeInfo seatTypeInfo, int quantity) { ApplyEvent(new SeatTypeAdded(Guid.NewGuid(), seatTypeInfo, quantity)); }
public SeatTypeAdded(Conference conference, Guid seatTypeId, SeatTypeInfo seatTypeInfo, int quantity) : base(conference, seatTypeId, seatTypeInfo) { Quantity = quantity; }
public SeatTypeEvent(Conference conference, Guid seatTypeId, SeatTypeInfo seatTypeInfo) : base(conference) { SeatTypeId = seatTypeId; SeatTypeInfo = seatTypeInfo; }
public SeatTypeAdded(Guid seatTypeId, SeatTypeInfo seatTypeInfo, int quantity) : base(seatTypeId, seatTypeInfo) { Quantity = quantity; }
public SeatTypeEvent(Guid seatTypeId, SeatTypeInfo seatTypeInfo) { SeatTypeId = seatTypeId; SeatTypeInfo = seatTypeInfo; }