public async Task <IHttpActionResult> WithoutReservation(TicketCreationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await cancelReservations.CancelExpiredReservationsAsync(DateTime.Now);

            NewTicketSummary summary = await newTicket.NewAsync(new Ticket(model.ProjectionId, model.Row, model.Column));

            if (summary.IsCreated)
            {
                return(Ok(summary.TicketOutputReceipt));
            }
            else
            {
                return(BadRequest(summary.Message));
            }
        }
Exemple #2
0
        public async Task <IHttpActionResult> AvailableSeats(AvailableSeatsModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await cancelReservations.CancelExpiredReservationsAsync(DateTime.Now);

            AvailableSeatsSummary summary = await checkingAvailableSeats
                                            .GetCountAsync(new ProjectionIdentifier(model.ProjectionId));

            if (summary.IsSuccessfull)
            {
                return(Ok(summary.AvailableSeats));
            }
            else
            {
                return(BadRequest(summary.Message));
            }
        }