Exemple #1
0
        public NewTicketSummery New(ITicketRequest ticket)
        {
            if (ticket.Guid == null)
            {
                IEnumerable <ITicket> boughtSites = ticketRepo.BoughtSeats(ticket.ProjectionId);

                IEnumerable <IReservation> reservationsSits = reservationRepo.GetRowsColsById(ticket.ProjectionId);

                foreach (var sit in boughtSites)
                {
                    if (ticket.Row == sit.Row && ticket.Column == sit.Column)
                    {
                        return(new NewTicketSummery(false, "This seat is already taken!"));
                    }
                }

                foreach (var reserv in reservationsSits)
                {
                    if (ticket.Row == reserv.Row && ticket.Column == reserv.Column)
                    {
                        return(new NewTicketSummery(false, "This seat is Reserved!"));
                    }
                }
            }
            return(newTicket.New(ticket));
        }