|
@@ -25,20 +25,48 @@ namespace AvaloniaApplication5.ViewModels
|
|
|
public PageUserCabinetViewModel PageUCabinetVM { get => pageUCabinetVM; set => pageUCabinetVM = value; }
|
|
|
|
|
|
private PageUserCabinetViewModel pageUCabinetVM;
|
|
|
-
|
|
|
- UserControl ucAdmin;
|
|
|
+ #region VMadmin
|
|
|
+
|
|
|
+ UserControl ucAdmin;
|
|
|
public UserControl UCAdmin
|
|
|
{
|
|
|
get => ucAdmin;
|
|
|
set => this.RaiseAndSetIfChanged(ref ucAdmin, value);
|
|
|
}
|
|
|
- public List<Logintable> UserList => DBConnect.Logintables.Include(x => x.IdRoleNavigation).Include(x => x.User.IdGenderNavigation).ToList();
|
|
|
+
|
|
|
+ public MainWindowViewModel()
|
|
|
+ {
|
|
|
+ userList = DBConnect.Logintables.Include(x => x.IdRoleNavigation).Include(x => x.User.IdGenderNavigation).ToList();
|
|
|
+ }
|
|
|
+ List<Logintable> userList;
|
|
|
+ public List<Logintable> UserList { get => userList; set =>this.RaiseAndSetIfChanged(ref userList,value); }
|
|
|
public void EditUser(int id)
|
|
|
{
|
|
|
- PageUCabinetVM = new PageUserCabinetViewModel(DBConnect, id);
|
|
|
+ PageUCabinetVM = id==0? new PageUserCabinetViewModel(DBConnect):new PageUserCabinetViewModel(DBConnect, id);
|
|
|
UCAdmin = new PageUserCabinet();
|
|
|
}
|
|
|
+ public List<string> OrdersName => new List<string>() { "По возрастанию", "По убыванию" };
|
|
|
+ string orderByName = "По возрастанию";
|
|
|
+ public string OrderByName {
|
|
|
+ get => orderByName;
|
|
|
+ set
|
|
|
+ {
|
|
|
+ orderByName = value;
|
|
|
+ switch (value)
|
|
|
+ {
|
|
|
+ case "По возрастанию":
|
|
|
+ UserList = UserList.OrderBy(x => x.User.Name).ToList();
|
|
|
+ break;
|
|
|
+ case "По убыванию":
|
|
|
+ UserList = UserList.OrderByDescending(x => x.User.Name).ToList();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
+ #endregion
|
|
|
|
|
|
public void LoadPageList()
|
|
|
{
|