示例#1
0
        public List <Equipment> GetEquipmentByRoomNumber(int roomNumber)
        {
            List <EquipmentInRooms> equipmentInRooms = _equipmentInRoomRepository.GetEquipmentInRoomsByRoomNumber(roomNumber);
            List <Equipment>        equipment        = new List <Equipment>();

            foreach (var e in equipmentInRooms)
            {
                equipment.Add(GetEquipmentById(e.IdEquipment));
            }

            return(equipment);
        }
        private ICollection <int> GetAvailableEquipmentTypesInRoom(Room room)
        {
            List <EquipmentInRooms> equipmentInRooms        = _equipmentInRoomsRepository.GetEquipmentInRoomsByRoomNumber(room.Id);
            ICollection <int>       availableEquipmentTypes = new List <int>();

            foreach (EquipmentInRooms equipmentInRoom in equipmentInRooms)
            {
                Equipment     equipment     = _equipmentRepository.GetEquipmentById(equipmentInRoom.IdEquipment);
                EquipmentType equipmentType = equipment.Type;
                if (!availableEquipmentTypes.Contains(equipmentType.Id))
                {
                    availableEquipmentTypes.Add(equipmentType.Id);
                }
            }

            return(availableEquipmentTypes);
        }