|
@@ -1,10 +1,10 @@
|
|
|
using YtYtAvalonia.Models;
|
|
|
using YtYtAvalonia.Views;
|
|
|
using YtYtAvalonia.ViewModels;
|
|
|
-
|
|
|
using Avalonia.Controls;
|
|
|
using ReactiveUI;
|
|
|
using YtYtAvalonia.View;
|
|
|
+using System.Linq;
|
|
|
|
|
|
namespace YtYtAvalonia.ViewModels
|
|
|
{
|
|
@@ -17,14 +17,28 @@ namespace YtYtAvalonia.ViewModels
|
|
|
RegistrationViewModel regPage = new RegistrationViewModel(myConnection);
|
|
|
public RegistrationViewModel RegPage { get => regPage; set => regPage = value; }
|
|
|
|
|
|
-#pragma warning restore CA1822 // Mark members as static
|
|
|
- public string Greeting => "Welcome to Avalonia!";
|
|
|
-
|
|
|
public UserControl UC { get => uc; set => this.RaiseAndSetIfChanged(ref uc, value); }
|
|
|
-#pragma warning restore CA1822 // Mark members as static
|
|
|
-
|
|
|
+
|
|
|
private UserControl uc = new LoginView();
|
|
|
|
|
|
public void LoadRegistrationView() => UC = new RegistrationView();
|
|
|
+
|
|
|
+ LoginViewModel loginVM = new LoginViewModel();
|
|
|
+ public LoginViewModel LoginVM { get => loginVM; set => loginVM = value; }
|
|
|
+
|
|
|
+
|
|
|
+ public void LoadPersonalAccount()
|
|
|
+ {
|
|
|
+ User? currentUser = myConnection.Users.FirstOrDefault(x => x.Login == LoginVM.Login && x.Password == LoginVM.Password);
|
|
|
+ if(currentUser == null)
|
|
|
+ {
|
|
|
+ LoginVM.Message = "Пользователя с такими данными не существует.";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LoginVM.Message = "Ecgt[!";
|
|
|
+ UC = new PersonalAccount();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|