// This method creates a new maze data with maze title public void createNewMazeData(string username, string mazeTitle) { if (userMazeData.ContainsKey(username)) { MazeCollection collection = userMazeData[username]; // Retrieve collection based on username collection.addNewMaze(mazeTitle); // Add new Maze into collection } else { MazeCollection collection = new MazeCollection(); collection.addNewMaze(mazeTitle); // Add new Maze into collection userMazeData.Add(username, collection); // Add username with mazeCollection into the Dictionary } }
// This method saves the new maze collection by username public void saveMazeCollectionByUsername(MazeCollection newCollection, string username) { userMazeData[username] = newCollection; }