/// <summary> /// Add a user to an existing room /// </summary> /// <param name="roomName">the name of the room the user is being added to.</param> /// <param name="user">the user being added to room</param> public static void AddUserToRoom(string roomName, User user) { // get the room's Id. Guid roomId = rooms.GetGuidByName(roomName); if (!roomId.Equals(Guid.Empty)) { RoomUser roomUser = new RoomUser() { RoomId = roomId, UserId = user.Id }; roomUsers.Create(roomUser); } }
/// <summary> /// Remove a user from an existing room. /// </summary> /// <param name="roomName">the name of the room the user is being removed from.</param> /// <param name="user">the user</param> public static void RemoveUserFromRoom(string roomName, User user) { // get the room's Id. Guid roomId = rooms.GetGuidByName(roomName); if (!roomId.Equals(Guid.Empty)) { RoomUser roomUser = new RoomUser() { RoomId = roomId, UserId = user.Id }; roomUsers.Delete(roomUser); } }