Пример #1
0
        public void CreatePerformance(PerformanceViewModel performanceViewModel)
        {
            var performance = new Performance
            {
                EventDateTime = performanceViewModel.Performance.EventDateTime,
                IsActive      = true,
                PerformerId   = performanceViewModel.Performance.PerformerDto.Id,
                VenueId       = performanceViewModel.Performance.VenueDto.Id,
            };

            IEnumerable <SimpleReservation> budgetReservations   = reservationService.CreateSimpleReservations(performance.VenueId, SeatType.Budget, performanceViewModel.BudgetPrice);
            IEnumerable <SimpleReservation> moderateReservations = reservationService.CreateSimpleReservations(performance.VenueId, SeatType.Moderate, performanceViewModel.ModeratePrice);
            IEnumerable <SimpleReservation> premierReservations  = reservationService.CreateSimpleReservations(performance.VenueId, SeatType.Premier, performanceViewModel.PremierPrice);

            IEnumerable <SimpleReservation> allReservations = reservationService.CombineReservations(budgetReservations, moderateReservations, premierReservations);

            _repository.Insert(performance);
            _repository.Commit();

            _reservationRepository.BulkInsertReservations(allReservations, performance.Id);
        }