Пример #1
0
        public async Task <IHttpActionResult> Stats(string reference)
        {
            try
            {
                Event evnt = await _eventRepository.GetActiveAsync();

                if (null == evnt)
                {
                    return(NotFound());
                }

                if (BookingsController.IsUnauthorized(reference))
                {
                    return(BadRequest("Request is unauthorized, or not logged in as the booking it's trying to read."));
                }

                BookingQueueStats bookingQueueStats = await _bookingRepository.GetQueueStatsByReferenceAsync(reference, evnt.Opening);

                if (null == bookingQueueStats)
                {
                    return(Ok(new BookingQueueStats()));
                }

                return(this.OkCacheControl(bookingQueueStats, WebConfig.StaticDataMaxAge));
            }
            catch (Exception ex)
            {
                _log.Error(ex, $"An unexpected exception occurred while getting the booking with reference {reference}.");
                throw;
            }
        }
Пример #2
0
        public async Task <IHttpActionResult> Get(string reference)
        {
            try
            {
                if (BookingsController.IsUnauthorized(reference))
                {
                    return(BadRequest("Request is unauthorized, or not logged in as the booking it's trying to read."));
                }

                Booking booking = await _bookingRepository.FindByReferenceAsync(reference);

                return(Ok(await _allocationRepository.GetByBookingAsync(booking)));
            }
            catch (Exception ex)
            {
                _log.Error(ex, $"An unexpected exception occurred while getting allocation for the booking with reference {reference}.");
                throw;
            }
        }