コード例 #1
0
        public SeatCapacity GetSeatsRemaining(int performanceId)
        {
            var capacity = new SeatCapacity();

            capacity.Budget = _reservationRepository.Collection()
                              .Where(res => res.PerformanceId == performanceId)
                              .Where(res => res.Seat.SeatType == SeatType.Budget)
                              .Where(res => res.IsTaken == false)
                              .Count();

            capacity.Moderate = _reservationRepository.Collection()
                                .Where(res => res.PerformanceId == performanceId)
                                .Where(res => res.Seat.SeatType == SeatType.Moderate)
                                .Where(res => res.IsTaken == false)
                                .Count();

            capacity.Premier = _reservationRepository.Collection()
                               .Where(res => res.PerformanceId == performanceId)
                               .Where(res => res.Seat.SeatType == SeatType.Premier)
                               .Where(res => res.IsTaken == false)
                               .Count();

            return(capacity);
        }
コード例 #2
0
        // GET: ReservationsManage
        public ActionResult Index()
        {
            List <Reservations> reservations = context.Collection().ToList();

            return(View(reservations));
        }