Пример #1
0
        public async Task <NewCreationSummary> New(ITicketCreation ticket)
        {
            var reservations = await reserveRepo.GetAllReservations();

            await reserveRepo.CancelExpiredReservations(reservations);

            var reservationDb = await reserveRepo.Get(ticket.Row, ticket.Column, ticket.ProjectionId);

            if (reservationDb == null)
            {
                return(new NewCreationSummary(false, "Cannot buy seats for expired reservation"));
            }

            return(await newTicket.New(ticket));
        }
        public async Task <NewCreationSummary> New(ITicketCreation ticket)
        {
            var reservations = await reserveRepo.GetAllReservations();

            await reserveRepo.CancelExpiredReservations(reservations);

            DateTime currentDate = DateTime.UtcNow;
            TimeSpan ts          = ticket.ProjectionStartDate - currentDate;

            if (ts.TotalMinutes > 0 && ts.TotalMinutes < 10)
            {
                return(new NewCreationSummary(false, "Cannot buy seats for projection starting in less than 10 minutes"));
            }

            return(await newTicket.New(ticket));
        }