public void Operation() { _containerInterfaces.SystemOutput.Print("All connected users"); string allConnectedUser = _serverHandler.GetAllUserConnected(); _containerInterfaces.SystemOutput.Print(allConnectedUser); _containerInterfaces.SystemOutput.Print("Please enter the name you want to open chat with him"); string name = _containerInterfaces.SystemInput.StringInput(); if (name == _clientname) { _containerInterfaces.SystemOutput.Print($"You cannot create private chat with yourself"); return; } if (!allConnectedUser.Contains(name)) { _containerInterfaces.SystemOutput.Print($"The user {name} is not in user list"); return; } var body = new PrivateChatMessageModel { RequestType = MessageType.PrivateCreationChat, lsUsers = new List <string>() { name } }; _serverHandler.CreateChat(body); }
public void Operation() { Console.WriteLine("All connected users"); string allConnectedUser = _serverHandler.GetAllUserConnected(); Console.WriteLine(allConnectedUser); Console.WriteLine("Please enter the name you want to open chat with him"); string name = Console.ReadLine(); if (name == _clientname) { Console.WriteLine($"You cannot create private chat with yourself"); return; } if (!allConnectedUser.Contains(name)) { Console.WriteLine($"The user {name} is not in user list"); return; } var body = new PrivateChatMessageModel { RequestType = "PrivateCreationChat", lsUsers = new List <string>() { name } }; _serverHandler.CreateChat(body); }