Benutzer können erstellt werden
This commit is contained in:
+29
-3
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user