예제 #1
0
        public List <MostUsedRoom> GetMostUsedClassroomsByBookings(IClassroomRepository classroomRepository, int amount, int week)
        {
            var allRooms     = classroomRepository.GetAllClassroomsWithBookingsRemoveEmpty(week);
            var orderedRooms = allRooms.OrderByDescending(r => r.Bookings.Count).Take(amount).ToList();
            var statistics   = orderedRooms.Select(s => new MostUsedRoom
            {
                RoomId          = s.RoomId,
                Top             = orderedRooms.IndexOf(s),
                AmountOfLessons = s.Bookings.Count,
            }).ToList();

            return(statistics);
        }