Ejemplo n.º 1
0
 public async Task<IEnumerable<Seat>> GetFreeSeatsAsync(Schedule schedule)
 {
     ValidateNotNull(schedule);
     await ValidateId(_scheduleDao, schedule.Id);
     var reservations = await _reservationDao.SelectReservationsByScheduleId(schedule.Id);
     if (!reservations.Any())
     {
         return await _seatDao.SelectActiveWithRowAndCategoryByCinemaHallAsync(schedule.CinemaHallId);
     }
     var occupiedSeats = await _seatReservationDao.SelectAllSeatIdsByReservationIdsAsync(reservations.Select(reservation => reservation.Id));
     return await _seatDao.SelectFreeSeatsByIdAsync(occupiedSeats);
 }
Ejemplo n.º 2
0
        public async Task <IEnumerable <Seat> > GetActiveSeatsWithRowAndCategoryAsync(long cinemaHallId)
        {
            await ValidateId(_cinemaHallDao, cinemaHallId);

            return(await _seatDao.SelectActiveWithRowAndCategoryByCinemaHallAsync(cinemaHallId));
        }