Jelajahi Sumber

Добавьте файлы проекта.

fly9024 11 bulan lalu
induk
melakukan
271228d51e

+ 25 - 0
AvaloniaApplication5.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33829.357
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaApplication5", "AvaloniaApplication5\AvaloniaApplication5.csproj", "{CDF68D16-F3F3-4C11-802E-D56B088F6162}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{CDF68D16-F3F3-4C11-802E-D56B088F6162}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{CDF68D16-F3F3-4C11-802E-D56B088F6162}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{CDF68D16-F3F3-4C11-802E-D56B088F6162}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{CDF68D16-F3F3-4C11-802E-D56B088F6162}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {F40A94D3-7F40-45BA-8C39-E6348E229234}
+	EndGlobalSection
+EndGlobal

+ 29 - 0
AvaloniaApplication5/App.axaml

@@ -0,0 +1,29 @@
+<Application xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             x:Class="AvaloniaApplication5.App"
+             xmlns:local="using:AvaloniaApplication5"
+             RequestedThemeVariant="Default">
+             <!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
+
+    <Application.DataTemplates>
+        <local:ViewLocator/>
+    </Application.DataTemplates>
+  
+    <Application.Styles>
+        <FluentTheme />
+		<Style Selector="TextBlock.AuthTBStyle">
+			<Setter Property="FontSize" Value="24"/>
+			<Setter Property="FontWeight" Value="Bold"/>
+		</Style>
+		<Style Selector="TextBlock.ErrorMessage">
+			<Setter Property="FontSize" Value="16"/>
+			<Setter Property="FontWeight" Value="Bold"/>
+			<Setter Property="FontFamily" Value="Arial"/>
+			<Setter Property="FontStyle" Value="Italic"/>
+			<Setter Property="Foreground" Value="Red"/>
+		</Style>
+		
+		
+		
+    </Application.Styles>
+</Application>

+ 29 - 0
AvaloniaApplication5/App.axaml.cs

@@ -0,0 +1,29 @@
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Markup.Xaml;
+using AvaloniaApplication5.ViewModels;
+using AvaloniaApplication5.Views;
+
+namespace AvaloniaApplication5
+{
+    public partial class App : Application
+    {
+        public override void Initialize()
+        {
+            AvaloniaXamlLoader.Load(this);
+        }
+
+        public override void OnFrameworkInitializationCompleted()
+        {
+            if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+            {
+                desktop.MainWindow = new MainWindow
+                {
+                    DataContext = new MainWindowViewModel(),
+                };
+            }
+
+            base.OnFrameworkInitializationCompleted();
+        }
+    }
+}

TEMPAT SAMPAH
AvaloniaApplication5/Assets/avalonia-logo.ico


+ 33 - 0
AvaloniaApplication5/AvaloniaApplication5.csproj

@@ -0,0 +1,33 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <OutputType>WinExe</OutputType>
+    <TargetFramework>net7.0</TargetFramework>
+    <Nullable>enable</Nullable>
+    <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
+    <ApplicationManifest>app.manifest</ApplicationManifest>
+    <AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Folder Include="Models\" />
+    <AvaloniaResource Include="Assets\**" />
+  </ItemGroup>
+
+
+  <ItemGroup>
+    <PackageReference Include="Avalonia" Version="11.0.2" />
+    <PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.2" />
+    <PackageReference Include="Avalonia.Desktop" Version="11.0.2" />
+    <PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.2" />
+    <PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.2" />
+    <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
+    <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.2" />
+    <PackageReference Include="Avalonia.ReactiveUI" Version="11.0.2" />
+    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.14" />
+    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.14">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
+    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
+  </ItemGroup>
+</Project>

+ 13 - 0
AvaloniaApplication5/Models/Gender.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+
+namespace AvaloniaApplication5.Models;
+
+public partial class Gender
+{
+    public int Id { get; set; }
+
+    public string Gender1 { get; set; } = null!;
+
+    public virtual ICollection<User> Users { get; set; } = new List<User>();
+}

+ 19 - 0
AvaloniaApplication5/Models/Logintable.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+
+namespace AvaloniaApplication5.Models;
+
+public partial class Logintable
+{
+    public int Id { get; set; }
+
+    public string Login { get; set; } = null!;
+
+    public string Password { get; set; } = null!;
+
+    public int IdRole { get; set; }
+
+    public virtual Role IdRoleNavigation { get; set; } = null!;
+
+    public virtual User? User { get; set; }
+}

+ 13 - 0
AvaloniaApplication5/Models/Role.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+
+namespace AvaloniaApplication5.Models;
+
+public partial class Role
+{
+    public int Id { get; set; }
+
+    public string Role1 { get; set; } = null!;
+
+    public virtual ICollection<Logintable> Logintables { get; set; } = new List<Logintable>();
+}

+ 19 - 0
AvaloniaApplication5/Models/User.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+
+namespace AvaloniaApplication5.Models;
+
+public partial class User
+{
+    public int IdLogin { get; set; }
+
+    public string Name { get; set; } = null!;
+
+    public int IdGender { get; set; }
+
+    public DateTime BirthDate { get; set; }
+
+    public virtual Gender IdGenderNavigation { get; set; } = null!;
+
+    public virtual Logintable IdLoginNavigation { get; set; } = null!;
+}

+ 110 - 0
AvaloniaApplication5/Models/_1234Context.cs

@@ -0,0 +1,110 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore;
+
+namespace AvaloniaApplication5.Models;
+
+public partial class _1234Context : DbContext
+{
+    public _1234Context()
+    {
+    }
+
+    public _1234Context(DbContextOptions<_1234Context> options)
+        : base(options)
+    {
+    }
+
+    public virtual DbSet<Gender> Genders { get; set; }
+
+    public virtual DbSet<Logintable> Logintables { get; set; }
+
+    public virtual DbSet<Role> Roles { get; set; }
+
+    public virtual DbSet<User> Users { get; set; }
+
+    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
+        => optionsBuilder.UseNpgsql("Host=edu.pg.ngknn.local;Port=5432;Database=1234;Username=41P;Password=12357");
+
+    protected override void OnModelCreating(ModelBuilder modelBuilder)
+    {
+        modelBuilder.Entity<Gender>(entity =>
+        {
+            entity.HasKey(e => e.Id).HasName("genders_pk");
+
+            entity.ToTable("genders");
+
+            entity.Property(e => e.Id)
+                .UseIdentityAlwaysColumn()
+                .HasColumnName("id");
+            entity.Property(e => e.Gender1)
+                .HasColumnType("character varying")
+                .HasColumnName("gender");
+        });
+
+        modelBuilder.Entity<Logintable>(entity =>
+        {
+            entity.HasKey(e => e.Id).HasName("logintable_pk");
+
+            entity.ToTable("logintable");
+
+            entity.Property(e => e.Id)
+                .UseIdentityAlwaysColumn()
+                .HasColumnName("id");
+            entity.Property(e => e.IdRole).HasColumnName("id_role");
+            entity.Property(e => e.Login)
+                .HasColumnType("character varying")
+                .HasColumnName("login");
+            entity.Property(e => e.Password).HasColumnType("character varying");
+
+            entity.HasOne(d => d.IdRoleNavigation).WithMany(p => p.Logintables)
+                .HasForeignKey(d => d.IdRole)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("logintable_fk");
+        });
+
+        modelBuilder.Entity<Role>(entity =>
+        {
+            entity.HasKey(e => e.Id).HasName("roles_pk");
+
+            entity.ToTable("roles");
+
+            entity.Property(e => e.Id).HasColumnName("id");
+            entity.Property(e => e.Role1)
+                .HasColumnType("character varying")
+                .HasColumnName("role");
+        });
+
+        modelBuilder.Entity<User>(entity =>
+        {
+            entity.HasKey(e => e.IdLogin).HasName("users_pk");
+
+            entity.ToTable("users");
+
+            entity.Property(e => e.IdLogin)
+                .ValueGeneratedNever()
+                .HasColumnName("id_login");
+            entity.Property(e => e.BirthDate)
+                .HasColumnType("timestamp without time zone")
+                .HasColumnName("birth_date");
+            entity.Property(e => e.IdGender).HasColumnName("id_gender");
+            entity.Property(e => e.Name)
+                .HasColumnType("character varying")
+                .HasColumnName("name");
+
+            entity.HasOne(d => d.IdGenderNavigation).WithMany(p => p.Users)
+                .HasForeignKey(d => d.IdGender)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("users_fk_1");
+
+            entity.HasOne(d => d.IdLoginNavigation).WithOne(p => p.User)
+                .HasForeignKey<User>(d => d.IdLogin)
+                .HasConstraintName("users_fk");
+        });
+
+        OnModelCreatingPartial(modelBuilder);
+    }
+
+    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
+}

+ 24 - 0
AvaloniaApplication5/Program.cs

@@ -0,0 +1,24 @@
+using Avalonia;
+using Avalonia.ReactiveUI;
+using System;
+
+namespace AvaloniaApplication5
+{
+    internal class Program
+    {
+        // Initialization code. Don't use any Avalonia, third-party APIs or any
+        // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
+        // yet and stuff might break.
+        [STAThread]
+        public static void Main(string[] args) => BuildAvaloniaApp()
+            .StartWithClassicDesktopLifetime(args);
+
+        // Avalonia configuration, don't remove; also used by visual designer.
+        public static AppBuilder BuildAvaloniaApp()
+            => AppBuilder.Configure<App>()
+                .UsePlatformDetect()
+                .WithInterFont()
+                .LogToTrace()
+                .UseReactiveUI();
+    }
+}

+ 28 - 0
AvaloniaApplication5/ViewLocator.cs

@@ -0,0 +1,28 @@
+using Avalonia.Controls;
+using Avalonia.Controls.Templates;
+using AvaloniaApplication5.ViewModels;
+using System;
+
+namespace AvaloniaApplication5
+{
+    public class ViewLocator : IDataTemplate
+    {
+        public Control Build(object data)
+        {
+            var name = data.GetType().FullName!.Replace("ViewModel", "View");
+            var type = Type.GetType(name);
+
+            if (type != null)
+            {
+                return (Control)Activator.CreateInstance(type)!;
+            }
+
+            return new TextBlock { Text = "Not Found: " + name };
+        }
+
+        public bool Match(object data)
+        {
+            return data is ViewModelBase;
+        }
+    }
+}

+ 62 - 0
AvaloniaApplication5/ViewModels/MainWindowViewModel.cs

@@ -0,0 +1,62 @@
+using Avalonia.Controls;
+using AvaloniaApplication5.Models;
+//using AvaloniaApplication5.Models;
+using AvaloniaApplication5.Views;
+using Microsoft.EntityFrameworkCore;
+using ReactiveUI;
+using System.Collections.Generic;
+using System.Linq;
+using Tmds.DBus.Protocol;
+
+namespace AvaloniaApplication5.ViewModels
+{
+    public class MainWindowViewModel : ViewModelBase
+    {
+        _1234Context DBConnect = new _1234Context();
+
+        private UserControl uc = new PageLogin();
+        public UserControl UC { get => uc;
+            set => this.RaiseAndSetIfChanged(ref uc, value); }
+
+              
+
+        PageLoginViewModel pageLoginVM = new PageLoginViewModel();
+        public PageLoginViewModel PageLoginVM { get => pageLoginVM; set => pageLoginVM = value; }
+        public PageUserCabinetViewModel PageUCabinetVM { get => pageUCabinetVM; set => pageUCabinetVM = value; }
+
+        private PageUserCabinetViewModel pageUCabinetVM;
+
+         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 void EditUser(int id)
+        {
+            PageUCabinetVM = new PageUserCabinetViewModel(DBConnect, id);
+            UCAdmin = new PageUserCabinet();
+        }
+
+
+        public void LoadPageList()
+        {
+            Logintable? currentUser = DBConnect.Logintables.FirstOrDefault(x => x.Login == PageLoginVM.Login && x.Password == PageLoginVM.Password);
+            if (currentUser != null)
+            {
+                switch (currentUser.IdRole)
+                {
+                    case 1:
+                        UC = new PageUserList();
+                        break;
+                    case 2:
+                        PageUCabinetVM = new PageUserCabinetViewModel(DBConnect,currentUser.Id);
+                        UC = new PageUserCabinet();
+                        break;
+                }
+            }
+            else PageLoginVM.Message = "Пользователь отсутствует в системе, либо указанные данные введены неверно";
+        }
+    }
+}

+ 24 - 0
AvaloniaApplication5/ViewModels/PageLoginViewModel.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Avalonia.Controls;
+using AvaloniaApplication5.Models;
+//using AvaloniaApplication5.Models;
+using AvaloniaApplication5.Views;
+using Microsoft.EntityFrameworkCore;
+using ReactiveUI;
+
+namespace AvaloniaApplication5.ViewModels
+{
+	public class PageLoginViewModel : ReactiveObject
+	{    
+        string login="";
+        string password="";
+        string message = "";      
+
+        public string Login { get => login; set => login = value; }
+        public string Password { get => password; set => password = value; }
+        public string Message { get => message; set => this.RaiseAndSetIfChanged(ref message,value); }
+       
+    }
+}

+ 52 - 0
AvaloniaApplication5/ViewModels/PageUserCabinetViewModel.cs

@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using AvaloniaApplication5.Models;
+using Microsoft.EntityFrameworkCore;
+using ReactiveUI;
+
+namespace AvaloniaApplication5.ViewModels
+{
+	public class PageUserCabinetViewModel : ReactiveObject
+	{
+
+        Logintable? currentUser;
+        _1234Context dBConnect;
+        string oldPass;
+        public PageUserCabinetViewModel(_1234Context dBConnect, int idUser)
+        {
+            this.dBConnect = dBConnect;
+            CurrentUser = dBConnect.Logintables.Include(x=>x.IdRoleNavigation).Include(x=>x.User.IdGenderNavigation).FirstOrDefault(x => x.Id == idUser);
+            oldPass = currentUser.Password;
+        }
+
+        public Logintable? CurrentUser { get => currentUser; set => currentUser = value; }
+
+        public List<string> Genders => dBConnect.Genders.Select(x=>x.Gender1).ToList();
+
+        public string DR { get => CurrentUser.User.BirthDate.ToString(); set => CurrentUser.User.BirthDate = DateTime.Parse(value); }
+        public bool ChangePass { get => changePass; set =>this.RaiseAndSetIfChanged(ref changePass, value); }
+        public string PasswordMatch { get => passwordMatch; set => passwordMatch = value; }
+        public string Message { get => message; set =>this.RaiseAndSetIfChanged(ref message,value); }
+
+        bool changePass;
+
+        string passwordMatch;
+        string message;
+
+       public void SaveData()
+        {
+           if (CurrentUser.Password == null || CurrentUser.Password =="") CurrentUser.Password = oldPass; 
+           if (changePass==(currentUser.Password == PasswordMatch))
+            {               
+                dBConnect.SaveChanges();
+                Message = "Ñîõðàíåíî óñïåøíî";
+            }
+           else
+            {
+                Message = "Ïàðîëè íå ñîâïàäàþò";
+            }           
+        }
+            
+    }
+}

+ 22 - 0
AvaloniaApplication5/ViewModels/UC1ViewModel.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Reactive.Linq;
+//using AvaloniaApplication5.Models;
+using ReactiveUI;
+using Microsoft.EntityFrameworkCore;//îáÿçàòåëüíî ïîäêëþ÷èòü äëÿ ðàáîòû ñ DBContext
+using Avalonia.Input.TextInput;
+
+namespace AvaloniaApplication5.ViewModels
+{
+	public class UC1ViewModel : ReactiveObject
+	{
+		
+        //include() âêëþ÷àåò ñóùíîñòè ïî ñâÿçÿì, ò.ê. èçíà÷àëüíî îíè íå âûòÿãèâàþòñÿ èç áàçû
+        //public List<UserTable> UserTables  => Globals.BaseConnection.UserTables.Include(x=>x.IdUserNavigation).Include(g => g.GenderNavigation).ToList();
+        //public List<UserTable> UserTables  => testContext.UserTables.ToList();
+       
+    }
+}
+

+ 8 - 0
AvaloniaApplication5/ViewModels/ViewModelBase.cs

@@ -0,0 +1,8 @@
+using ReactiveUI;
+
+namespace AvaloniaApplication5.ViewModels
+{
+    public class ViewModelBase : ReactiveObject
+    {
+    }
+}

+ 19 - 0
AvaloniaApplication5/Views/MainWindow.axaml

@@ -0,0 +1,19 @@
+<Window xmlns="https://github.com/avaloniaui"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:vm="using:AvaloniaApplication5.ViewModels"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+        x:Class="AvaloniaApplication5.Views.MainWindow"
+        x:DataType="vm:MainWindowViewModel"
+        Icon="/Assets/avalonia-logo.ico"
+        Title="AvaloniaApplication5">
+
+    <Design.DataContext>
+        <!-- This only sets the DataContext for the previewer in an IDE,
+             to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
+        <vm:MainWindowViewModel/>
+    </Design.DataContext>
+	<ContentControl Content="{Binding UC}" Name="MainFrame"/>
+   
+</Window>

+ 12 - 0
AvaloniaApplication5/Views/MainWindow.axaml.cs

@@ -0,0 +1,12 @@
+using Avalonia.Controls;
+
+namespace AvaloniaApplication5.Views
+{
+    public partial class MainWindow : Window
+    {
+        public MainWindow()
+        {
+            InitializeComponent();           
+        }
+    }
+}

+ 22 - 0
AvaloniaApplication5/Views/PageLogin.axaml

@@ -0,0 +1,22 @@
+<UserControl xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+             xmlns:vm="using:AvaloniaApplication5.ViewModels"
+			 x:DataType="vm:MainWindowViewModel"
+			 x:Class="AvaloniaApplication5.Views.PageLogin">
+	<!--<Design.DataContext>
+		<vm:MainWindowViewModel/>
+	</Design.DataContext>-->
+	
+	<StackPanel>
+		
+		<TextBlock Classes="AuthTBStyle" Text="Введите логин"/>
+		<TextBox Text="{Binding PageLoginVM.Login}"/>
+		<TextBlock Classes="AuthTBStyle" Text="Введите пароль"/>
+		<TextBox PasswordChar="•" Text="{Binding PageLoginVM.Password}"/>
+		<Button Content="Войти" Command="{Binding LoadPageList}"/>
+		<TextBlock Classes="ErrorMessage" Text="{Binding PageLoginVM.Message}"/>
+	</StackPanel>
+</UserControl>

+ 15 - 0
AvaloniaApplication5/Views/PageLogin.axaml.cs

@@ -0,0 +1,15 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+using AvaloniaApplication5.ViewModels;
+
+namespace AvaloniaApplication5.Views;
+
+public partial class PageLogin : UserControl
+{
+    public PageLogin()
+    {
+        InitializeComponent();
+     //   DataContext = new PageLoginViewModel();
+    }
+}

+ 31 - 0
AvaloniaApplication5/Views/PageUserCabinet.axaml

@@ -0,0 +1,31 @@
+<UserControl xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+             xmlns:vm="using:AvaloniaApplication5.ViewModels"
+             x:DataType="vm:MainWindowViewModel"
+			 x:Class="AvaloniaApplication5.Views.PageUserCabinet">
+	<StackPanel>
+		<TextBlock Text="Имя"/>
+		<TextBox Text="{Binding PageUCabinetVM.CurrentUser.User.Name}"/>
+		<TextBlock Text="Логин"/>
+		<TextBox Text="{Binding PageUCabinetVM.CurrentUser.Login}"/>
+		<CheckBox Content="Изменить парль" IsChecked="{Binding PageUCabinetVM.ChangePass}"/>
+		<StackPanel IsVisible="{Binding PageUCabinetVM.ChangePass}">
+			<TextBlock Text="Введите новый пароль"/>
+			<TextBox Text="{Binding PageUCabinetVM.CurrentUser.Password,Mode=OneWayToSource}" PasswordChar="•"/>
+			<TextBlock Text="Повторите пароль"/>
+			<TextBox Text="{Binding PageUCabinetVM.PasswordMatch}" PasswordChar="•"/>
+		</StackPanel>
+		<TextBlock Text="Роль в системе"/>
+		<TextBlock Text="{Binding PageUCabinetVM.CurrentUser.IdRoleNavigation.Role1}"/>
+		<TextBlock Text="Пол"/>
+		<ComboBox ItemsSource="{Binding PageUCabinetVM.Genders}" SelectedValue="{Binding PageUCabinetVM.CurrentUser.User.IdGenderNavigation.Gender1}"/>
+		<TextBlock Text="Дата рождения"/>
+		<DatePicker SelectedDate="{Binding PageUCabinetVM.DR}"/>
+		<TextBlock Text="{Binding  PageUCabinetVM.Message}"/>
+		<Button Content="Сохранить изменения" Command="{Binding PageUCabinetVM.SaveData}"/>
+		<Button Content="К списку пользователей" />
+	</StackPanel>
+</UserControl>

+ 13 - 0
AvaloniaApplication5/Views/PageUserCabinet.axaml.cs

@@ -0,0 +1,13 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace AvaloniaApplication5.Views;
+
+public partial class PageUserCabinet : UserControl
+{
+    public PageUserCabinet()
+    {
+        InitializeComponent();
+    }
+}

+ 32 - 0
AvaloniaApplication5/Views/PageUserList.axaml

@@ -0,0 +1,32 @@
+<UserControl xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+              xmlns:vm="using:AvaloniaApplication5.ViewModels"
+             x:DataType="vm:MainWindowViewModel"
+			 x:Class="AvaloniaApplication5.Views.PageUserList">
+	<Grid ColumnDefinitions="*,*">
+		<ListBox Grid.Column="0" ItemsSource="{Binding UserList}">
+			<ListBox.ItemTemplate>
+				<DataTemplate>
+					<StackPanel>
+						<TextBlock Text="Имя"/>
+						<TextBlock Text="{Binding User.Name}"/>
+						<TextBlock Text="Логин"/>
+						<TextBlock Text="{Binding Login}"/>
+						<TextBlock Text="Роль в системе"/>
+						<TextBlock Text="{Binding IdRoleNavigation.Role1}"/>
+						<TextBlock Text="Пол"/>
+						<TextBlock Text="{Binding User.IdGenderNavigation.Gender1}"/>
+						<TextBlock Text="Дата рождения"/>
+						<TextBlock Text="{Binding User.BirthDate}"/>
+						<Button  Content="Редактировать" Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditUser}" CommandParameter="{Binding Id}"/>
+					</StackPanel>
+				</DataTemplate>
+			</ListBox.ItemTemplate>
+		</ListBox>
+		<ContentControl Grid.Column="1" Content="{Binding UCAdmin}"/>
+	</Grid>
+	
+</UserControl>

+ 13 - 0
AvaloniaApplication5/Views/PageUserList.axaml.cs

@@ -0,0 +1,13 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace AvaloniaApplication5.Views;
+
+public partial class PageUserList : UserControl
+{
+    public PageUserList()
+    {
+        InitializeComponent();
+    }
+}

+ 18 - 0
AvaloniaApplication5/app.manifest

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
+  <!-- This manifest is used on Windows only.
+       Don't remove it as it might cause problems with window transparency and embeded controls.
+       For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
+  <assemblyIdentity version="1.0.0.0" name="AvaloniaApplication5.Desktop"/>
+
+  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+    <application>
+      <!-- A list of the Windows versions that this application has been tested on
+           and is designed to work with. Uncomment the appropriate elements
+           and Windows will automatically select the most compatible environment. -->
+
+      <!-- Windows 10 -->
+      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
+    </application>
+  </compatibility>
+</assembly>

+ 1 - 0
AvaloniaApplication5/подключение.txt

@@ -0,0 +1 @@
+dotnet ef dbcontext scaffold "Host=edu.pg.ngknn.local;Port=5432;Database=1234;Username=41P;Password=12357" Npgsql.EntityFrameworkCore.PostgreSQL -o Models -f