|
@@ -11,7 +11,7 @@ namespace AvaloniaApplication2.ViewModels
|
|
|
{
|
|
|
public partial class MainWindowViewModel : ViewModelBase
|
|
|
{
|
|
|
- TestBase41pContext db = new TestBase41pContext();
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -19,25 +19,20 @@ namespace AvaloniaApplication2.ViewModels
|
|
|
[ObservableProperty] string login;
|
|
|
[ObservableProperty] string password;
|
|
|
[ObservableProperty] string info;
|
|
|
- [ObservableProperty] Logined? currentUser;
|
|
|
- [ObservableProperty] List<Gender> gendersList;
|
|
|
-
|
|
|
+ [ObservableProperty] Logined? currentUser;
|
|
|
+ [ObservableProperty] Page2ViewModel page2VM;
|
|
|
[ObservableProperty] UserControl page = new Page1();
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ public static MainWindowViewModel Self;
|
|
|
public MainWindowViewModel()
|
|
|
{
|
|
|
- gendersList = db.Genders.ToList();
|
|
|
+ Self = this;
|
|
|
}
|
|
|
|
|
|
- public DateTimeOffset DateTimeOffset
|
|
|
- {
|
|
|
- get=>new DateTimeOffset((DateTime)currentUser.User.BirthDate,TimeSpan.Zero);
|
|
|
- set => currentUser.User.BirthDate = new DateTime(value.Year,value.Month,value.Day);
|
|
|
- }
|
|
|
-
|
|
|
- public void GoBack() => Page = new Page1();
|
|
|
+
|
|
|
|
|
|
- public void Save() => db.SaveChanges();
|
|
|
+
|
|
|
|
|
|
|
|
|
public void Enter()
|
|
@@ -48,9 +43,10 @@ namespace AvaloniaApplication2.ViewModels
|
|
|
switch (CurrentUser.IdRole)
|
|
|
{
|
|
|
case 1:
|
|
|
- Page = new PageStartAdmin(db.Users.Include(x=>x.IdUserNavigation.IdRoleNavigation).ToList());
|
|
|
+ Page = new PageStartAdmin();
|
|
|
break;
|
|
|
case 2:
|
|
|
+ page2VM = new Page2ViewModel(currentUser.User.IdUser);
|
|
|
Page = new Page2();
|
|
|
break;
|
|
|
}
|
|
@@ -63,6 +59,6 @@ namespace AvaloniaApplication2.ViewModels
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+ // public void EditUser(int id) => Page = new Page2();
|
|
|
}
|
|
|
}
|