private void CreateLobby(object sender, RoutedEventArgs e) { LobbyNameBorder.BorderBrush = (Brush)FindResource("InputFormColor"); PasswordBorder.BorderBrush = (Brush)FindResource("InputFormColor"); ConfirmPasswordBorder.BorderBrush = (Brush)FindResource("InputFormColor"); string lobbyName = LobbyNameTextBox.Text; int playerCount = GetPlayerCount(); if (string.IsNullOrEmpty(lobbyName) || lobbyName.Length < 3) { LobbyNameBorder.BorderBrush = (Brush)FindResource("IncorrectColor"); return; } if (PasswordCheckbox.IsChecked == true) { string pass = PasswordTextBox.Password; string passConf = ConfirmPasswordTextBox.Password; if (ValidatePassword(pass, passConf)) { _proxy.CreatePrivateLobby(lobbyName, playerCount, pass); this.DialogResult = true; } } else { // string pass = PasswordTextBox.Password; _proxy.CreateLobby(lobbyName, playerCount); //LobbyCreateTest lb = LobbyCreateTest.Instance; //lb.CreateLobby(lobbyName, playerCount); this.DialogResult = true; } }
public ActionResult CreateLobby(LobbyViewModel lobbyViewModel, int categoryId) { if (ModelState.IsValid) { lobbyViewModel.lobby.name = lobbyViewModel.name; lobbyViewModel.category.id = categoryId; lobbyViewModel.lobby.category = lobbyViewModel.category; lobbyViewModel.lobby.isStarted = false; lobbyViewModel.lobbyUser.id = userClient.GetUserByUsername(SessionLogin.UserName).id; lobbyClient.CreateLobby(lobbyViewModel.lobby, lobbyViewModel.lobbyUser); return(RedirectToAction("Lobby", new { categoryId = categoryId })); } return(View(lobbyViewModel)); }