예제 #1
0
        //Getting the room by searching the ID
        public Room getRoom(int id)
        {
            using (RoomRepository roomRepository = new RoomRepository("DefaultConnection"))
            {
                Room room = roomRepository.findOneRoom(id);

                room.Section = sectionLogic.findOneSection(room.SectionID);

                room.Levels = room_LevelsLogic.getRoomLevels(id);
                return(room);
            }
        }
예제 #2
0
        //After registering, you direct to categories.
        //Finding the section by the id, and creating a room for that section.
        //Finding a player by its username and then assigning that player in a room .
        //After finding the section - creating the room and assigning the player in a room (updating the player's room).
        //For creating a room we need to know the sectionID and the userName who has chosen that.
        //We create a section and a room.
        public Room chooseSection(int id, string userName)
        {
            using (PlayerRepository playerRepository = new PlayerRepository("DefaultConnection"))
            {
                Section section = sectionLogic.findOneSection(id);

                Room room = new Room(0, section);

                roomLogic.createRoom(room);
                Player player = playerRepository.findOnePlayer(userName);

                player.Room = room;
                playerRepository.updatePlayer(player);
                player_status.CreatePlayerStatusForARoom(player, room);

                return(room);
            }
        }