Benutzer können erstellt werden

This commit is contained in:
NBTEMP\bib
2026-09-13 16:51:51 +02:00
parent abd23b4909
commit bf0f703f28
4 changed files with 67 additions and 13 deletions
+29 -3
View File
@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -13,8 +15,8 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Xml.Linq;
using Mysqlx.Cursor;
using System.Security.Cryptography;
namespace Casino
@@ -90,6 +92,30 @@ namespace Casino
}
}
}
private void Erstellen_Click(object sender, RoutedEventArgs e)
{
Database db = new Database();
ObservableCollection<User> users = new ObservableCollection<User>();
users = db.GetUser();
string hash = HashPassword(TxtPasswort.Password);
for (int i = 0; i < users.Count(); i++)
{
if (users[i].Name.Equals(TxtName))
{
return;
} else
{
User NewUser = new User(TxtName.Text, 18, hash);
db.InsertUser(NewUser);
TxtName.Text = "";
TxtPasswort.Password = "";
return;
}
}
}
}
}