Esempio n. 1
0
        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));
            }
        }
Esempio n. 2
0
 public SeatTypeUpdated(Conference conference, Guid seatTypeId, SeatTypeInfo seatTypeInfo)
     : base(conference, seatTypeId, seatTypeInfo)
 {
 }
Esempio n. 3
0
 public SeatType(Guid id, SeatTypeInfo info)
 {
     Id   = id;
     Info = info;
 }
Esempio n. 4
0
 public SeatTypeUpdated(Guid seatTypeId, SeatTypeInfo seatTypeInfo)
     : base(seatTypeId, seatTypeInfo)
 {
 }
Esempio n. 5
0
 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;
 }
Esempio n. 7
0
 public SeatTypeUpdated(Conference conference, Guid seatTypeId, SeatTypeInfo seatTypeInfo)
     : base(conference, seatTypeId, seatTypeInfo) { }
Esempio n. 8
0
 public SeatTypeEvent(Conference conference, Guid seatTypeId, SeatTypeInfo seatTypeInfo)
     : base(conference)
 {
     SeatTypeId   = seatTypeId;
     SeatTypeInfo = seatTypeInfo;
 }
Esempio n. 9
0
 public SeatTypeAdded(Guid seatTypeId, SeatTypeInfo seatTypeInfo, int quantity)
     : base(seatTypeId, seatTypeInfo)
 {
     Quantity = quantity;
 }
Esempio n. 10
0
 public SeatTypeAdded(Conference conference, Guid seatTypeId, SeatTypeInfo seatTypeInfo, int quantity)
     : base(conference, seatTypeId, seatTypeInfo)
 {
     Quantity = quantity;
 }
Esempio n. 11
0
 public SeatTypeEvent(Guid seatTypeId, SeatTypeInfo seatTypeInfo)
 {
     SeatTypeId   = seatTypeId;
     SeatTypeInfo = seatTypeInfo;
 }
Esempio n. 12
0
 public SeatType(Guid id, SeatTypeInfo info)
 {
     Id = id;
     Info = info;
 }
Esempio n. 13
0
 public SeatTypeAdded(Guid seatTypeId, SeatTypeInfo seatTypeInfo, int quantity)
     : base(seatTypeId, seatTypeInfo)
 {
     Quantity = quantity;
 }
Esempio n. 14
0
 public SeatTypeUpdated(Guid seatTypeId, SeatTypeInfo seatTypeInfo)
     : base(seatTypeId, seatTypeInfo)
 {
 }