/**
         * Gets all Reservations at a Performance, separated by SeatType
         * Maps each reservation's Price
         * Regroups and returns all Reservations at a Performance into an IEnumerable<Reservation>
         */
        public void SetNewReservationPrices(int performanceId, ReservationPrices prices)
        {
            var budget = new UpdatePricesObject {
                PerformanceId = performanceId,
                Type          = SeatType.Budget,
                Price         = prices.Budget
            };

            var moderate = new UpdatePricesObject
            {
                PerformanceId = performanceId,
                Type          = SeatType.Moderate,
                Price         = prices.Moderate
            };

            var premier = new UpdatePricesObject
            {
                PerformanceId = performanceId,
                Type          = SeatType.Premier,
                Price         = prices.Premier
            };

            _reservationRepository.ChangeReservationPrices(budget);
            _reservationRepository.ChangeReservationPrices(moderate);
            _reservationRepository.ChangeReservationPrices(premier);
        }
Beispiel #2
0
        public void EditPerformance(PerformanceViewModel performanceViewModel, int id)
        {
            Performance performanceToEdit = CheckPerformanceNullValue(id);

            performanceToEdit.EventDateTime = performanceViewModel.Performance.EventDateTime;
            performanceToEdit.IsActive      = true;
            performanceToEdit.PerformerId   = performanceViewModel.Performance.PerformerDto.Id;
            performanceToEdit.VenueId       = performanceViewModel.Performance.VenueDto.Id;

            ReservationPrices prices = new ReservationPrices
            {
                Budget   = performanceViewModel.BudgetPrice,
                Moderate = performanceViewModel.ModeratePrice,
                Premier  = performanceViewModel.PremierPrice
            };

            reservationService.SetNewReservationPrices(id, prices);

            _repository.Commit();
        }
        public ReservationPrices GetPrices(int performanceId)
        {
            var capacity = new ReservationPrices();

            capacity.Budget = Context.Reservations
                              .Where(res => res.Seat.SeatType == SeatType.Budget)
                              .Where(res => res.PerformanceId == performanceId)
                              .First()
                              .Price;

            capacity.Moderate = Context.Reservations
                                .Where(res => res.Seat.SeatType == SeatType.Moderate)
                                .Where(res => res.PerformanceId == performanceId)
                                .First()
                                .Price;

            capacity.Premier = Context.Reservations
                               .Where(res => res.Seat.SeatType == SeatType.Premier)
                               .Where(res => res.PerformanceId == performanceId)
                               .First()
                               .Price;

            return(capacity);
        }