Ejemplo n.º 1
0
        public int AvailableAllocation()
        {
            int salesAndReservations = 0;

            PurchasedTickets.ForEach(p => salesAndReservations   += p.TicketQuantity);
            TicketReservations.ForEach(p => salesAndReservations += p.TicketQuantity);
            return(Allocation - salesAndReservations);
        }
Ejemplo n.º 2
0
        public TicketReservation GetReservationWith(Guid reservationId)
        {
            if (!HasReservationWith(reservationId))
            {
                throw new ApplicationException(String.Format("No reservation ticket with matching id of {0}", reservationId.ToString()));
            }

            return(TicketReservations.FirstOrDefault(p => p.Id == reservationId));
        }
Ejemplo n.º 3
0
        public TicketReservation ReserveTicket(int tktQty)
        {
            if (!CanReserveTicket(tktQty))
            {
                ThrowExceptionWithDetailsOnWhyTicketsCannotBeReserved();
            }

            TicketReservation reservation = TicketReservationFactory.CreateReservation(this, tktQty);

            TicketReservations.Add(reservation);
            return(reservation);
        }
Ejemplo n.º 4
0
 private bool HasReservationWith(Guid reservationId)
 {
     return(TicketReservations.Any(p => p.Id == reservationId));
 }