private void AddUserConfirmBtn_Click(object sender, RoutedEventArgs e) { string role = ""; string group = ""; if ($"{AddNewUserRoleCBox.SelectedItem as string}" == "Student") { group = $"{AddNewUserGroupCBox.SelectedItem as string}"; } role = $"{AddNewUserRoleCBox.SelectedItem as string}"; if (AddNewUserRoleCBox.SelectedIndex != -1 && AddUserLoginBox.Text != "" && AddUSerPasswordBox.Password != "") { DataAccessClass.AddUser(AddUserLoginBox.Text, AddUSerPasswordBox.Password, role, group); users = DataAccessClass.GetUsers(); UsersGrid.ItemsSource = users; AddUserLoginBox.Text = ""; AddUSerPasswordBox.Password = ""; AddNewUserRoleCBox.SelectedIndex = -1; AddNewUserGroupCBox.SelectedIndex = -1; AddNewUserFlyout.Hide(); } }