public static TicketPurchase CreateTicket(Event pEvent, int ticketQuantity)
        {
            TicketPurchase tiketPurchase = new TicketPurchase();

            tiketPurchase.Id             = Guid.NewGuid();
            tiketPurchase.Event          = pEvent;
            tiketPurchase.TicketQuantity = ticketQuantity;

            return(tiketPurchase);
        }
Example #2
0
        public TicketPurchase PurchaseTicketWith(Guid reservationId)
        {
            if (!CanPurchaseTicketWith(reservationId))
            {
                throw new ApplicationException("此预定票不能被购买");
            }
            TicketReservation ticketReservation = GetTicketReservationWith(reservationId);
            TicketPurchase    ticketPurchase    = TicketPurchaseFactory.CreateTicket(this, ticketReservation.TicketQuantity);

            ticketReservation.HasBeenRedeemed = true;
            TicketPurchases.Add(ticketPurchase);

            return(ticketPurchase);
        }