39 lines
943 B
C#
39 lines
943 B
C#
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Markup.Xaml;
|
|
using Blagodat.Models;
|
|
|
|
namespace Blagodat;
|
|
|
|
public partial class Registration : Window
|
|
{
|
|
public Registration()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
private void RegisterClick_OnClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(LoginTextBox.Text)) return;
|
|
if (string.IsNullOrEmpty(PasswordTextBox.Text)) return;
|
|
using var dbContext = new User7Context();
|
|
var user = new Client
|
|
{
|
|
Fio = LoginTextBox.Text,
|
|
Password = PasswordTextBox.Text
|
|
};
|
|
dbContext.Clients.Add(user);
|
|
if (dbContext.SaveChanges() > 0)
|
|
{
|
|
new MainWindow().Show();
|
|
Close();
|
|
}
|
|
}
|
|
|
|
private void LoginClick_OnClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
new MainWindow().Show();
|
|
Close();
|
|
}
|
|
}
|