示例#1
0
        public async Task <IHttpActionResult> Solo(SoloBookingSource bookingSource)
        {
            try
            {
                Event evnt = await _eventRepository.GetActiveAsync();

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

                if (!evnt.HasOpened)
                {
                    _log.Warn("An attempt was made to create a solo booking before the event is open.");
                    return(BadRequest());
                }

                BookingResult result = await _bookingRepository.CreateSoloAsync(evnt, bookingSource);

                _log.Info("Created solo booking {0}.", result.Reference);

                await SendBookingCreatedMailAsync(evnt, bookingSource, result);

                return(Ok(result));
            }
            catch (Exception ex)
            {
                _log.Error(ex, "An unexpected exception occurred while creating a solo booking.");
                throw;
            }
        }