Бобарикке 2 weken geleden
bovenliggende
commit
4ae8085c77
28 gewijzigde bestanden met toevoegingen van 673 en 84 verwijderingen
  1. 0 6
      AvaloniaApplication1/AvaloniaApplication1.csproj
  2. 33 0
      AvaloniaApplication1/Models/Bobarik41pContext.cs
  3. 13 0
      AvaloniaApplication1/Models/Property.cs
  4. 15 0
      AvaloniaApplication1/Models/SmeshProperty.cs
  5. 2 0
      AvaloniaApplication1/Models/Smeshariki.cs
  6. 116 0
      AvaloniaApplication1/ViewModels/AddSmeshViewModel.cs
  7. 73 0
      AvaloniaApplication1/ViewModels/AdminUsersViewModel.cs
  8. 27 0
      AvaloniaApplication1/ViewModels/AdminViewModel.cs
  9. 4 2
      AvaloniaApplication1/ViewModels/MainPageViewModel.cs
  10. 1 1
      AvaloniaApplication1/ViewModels/MainWindowViewModel.cs
  11. 8 7
      AvaloniaApplication1/ViewModels/RegistrationPageViewModel - Копировать.cs
  12. 33 6
      AvaloniaApplication1/ViewModels/UpdateSmesharikViewModel.cs
  13. 34 0
      AvaloniaApplication1/ViewModels/UpdateUsersViewModel.cs
  14. 25 5
      AvaloniaApplication1/ViewModels/UserMainViewModel.cs
  15. 46 0
      AvaloniaApplication1/Views/AddSmesh.axaml
  16. 15 0
      AvaloniaApplication1/Views/AddSmesh.axaml.cs
  17. 19 0
      AvaloniaApplication1/Views/AdminPage.axaml
  18. 15 0
      AvaloniaApplication1/Views/AdminPage.axaml.cs
  19. 42 0
      AvaloniaApplication1/Views/AdminUsers.axaml
  20. 15 0
      AvaloniaApplication1/Views/AdminUsers.axaml.cs
  21. 39 35
      AvaloniaApplication1/Views/MainPage.axaml
  22. 0 2
      AvaloniaApplication1/Views/MainPage.axaml.cs
  23. 1 0
      AvaloniaApplication1/Views/ProfileUser.axaml
  24. 37 19
      AvaloniaApplication1/Views/UpdateSmesharik.axaml
  25. 43 0
      AvaloniaApplication1/Views/UpdateUsers.axaml
  26. 15 0
      AvaloniaApplication1/Views/UpdateUsers.axaml.cs
  27. 1 1
      AvaloniaApplication1/Views/UserPage.axaml
  28. 1 0
      AvaloniaApplication1/db.txt

+ 0 - 6
AvaloniaApplication1/AvaloniaApplication1.csproj

@@ -31,10 +31,4 @@
     </PackageReference>
     </PackageReference>
     <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.18" />
     <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.18" />
   </ItemGroup>
   </ItemGroup>
-
-  <ItemGroup>
-    <Compile Update="Views\MainPage.axaml.cs">
-      <DependentUpon>MainPage.axaml</DependentUpon>
-    </Compile>
-  </ItemGroup>
 </Project>
 </Project>

+ 33 - 0
AvaloniaApplication1/Models/Bobarik41pContext.cs

@@ -17,6 +17,8 @@ public partial class Bobarik41pContext : DbContext
 
 
     public virtual DbSet<Gender> Genders { get; set; }
     public virtual DbSet<Gender> Genders { get; set; }
 
 
+    public virtual DbSet<Property> Properties { get; set; }
+
     public virtual DbSet<Role> Roles { get; set; }
     public virtual DbSet<Role> Roles { get; set; }
 
 
     public virtual DbSet<Smeshariki> Smesharikis { get; set; }
     public virtual DbSet<Smeshariki> Smesharikis { get; set; }
@@ -41,6 +43,18 @@ public partial class Bobarik41pContext : DbContext
                 .HasColumnName("title");
                 .HasColumnName("title");
         });
         });
 
 
+        modelBuilder.Entity<Property>(entity =>
+        {
+            entity.HasKey(e => e.Id).HasName("property_pkey");
+
+            entity.ToTable("property");
+
+            entity.Property(e => e.Id).HasColumnName("id");
+            entity.Property(e => e.Title)
+                .HasMaxLength(50)
+                .HasColumnName("title");
+        });
+
         modelBuilder.Entity<Role>(entity =>
         modelBuilder.Entity<Role>(entity =>
         {
         {
             entity.HasKey(e => e.Id).HasName("role_pkey");
             entity.HasKey(e => e.Id).HasName("role_pkey");
@@ -73,6 +87,25 @@ public partial class Bobarik41pContext : DbContext
             entity.HasOne(d => d.GenderNavigation).WithMany(p => p.Smesharikis)
             entity.HasOne(d => d.GenderNavigation).WithMany(p => p.Smesharikis)
                 .HasForeignKey(d => d.Gender)
                 .HasForeignKey(d => d.Gender)
                 .HasConstraintName("smeshariki_gender_fkey");
                 .HasConstraintName("smeshariki_gender_fkey");
+
+            entity.HasMany(d => d.IdProperties).WithMany(p => p.IdSmeshes)
+                .UsingEntity<Dictionary<string, object>>(
+                    "SmeshProperty",
+                    r => r.HasOne<Property>().WithMany()
+                        .HasForeignKey("IdProperty")
+                        .OnDelete(DeleteBehavior.ClientSetNull)
+                        .HasConstraintName("smesh_property_id_property_fkey"),
+                    l => l.HasOne<Smeshariki>().WithMany()
+                        .HasForeignKey("IdSmesh")
+                        .OnDelete(DeleteBehavior.ClientSetNull)
+                        .HasConstraintName("smesh_property_id_smesh_fkey"),
+                    j =>
+                    {
+                        j.HasKey("IdSmesh", "IdProperty").HasName("smesh_property_pk");
+                        j.ToTable("smesh_property");
+                        j.IndexerProperty<int>("IdSmesh").HasColumnName("id_smesh");
+                        j.IndexerProperty<int>("IdProperty").HasColumnName("id_property");
+                    });
         });
         });
 
 
         modelBuilder.Entity<User>(entity =>
         modelBuilder.Entity<User>(entity =>

+ 13 - 0
AvaloniaApplication1/Models/Property.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+
+namespace AvaloniaApplication1.Models;
+
+public partial class Property
+{
+    public int Id { get; set; }
+
+    public string? Title { get; set; }
+
+    public virtual ICollection<Smeshariki> IdSmeshes { get; set; } = new List<Smeshariki>();
+}

+ 15 - 0
AvaloniaApplication1/Models/SmeshProperty.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+
+namespace AvaloniaApplication1.Models;
+
+public partial class SmeshProperty
+{
+    public int? IdSmesh { get; set; }
+
+    public int? IdProperty { get; set; }
+
+    public virtual Property? IdPropertyNavigation { get; set; }
+
+    public virtual Smeshariki? IdSmeshNavigation { get; set; }
+}

+ 2 - 0
AvaloniaApplication1/Models/Smeshariki.cs

@@ -18,4 +18,6 @@ public partial class Smeshariki
     public byte[]? Image { get; set; }
     public byte[]? Image { get; set; }
 
 
     public virtual Gender? GenderNavigation { get; set; }
     public virtual Gender? GenderNavigation { get; set; }
+
+    public virtual ICollection<Property> IdProperties { get; set; } = new List<Property>();
 }
 }

+ 116 - 0
AvaloniaApplication1/ViewModels/AddSmeshViewModel.cs

@@ -0,0 +1,116 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Avalonia.Controls.ApplicationLifetimes;
+using System.Threading.Tasks;
+using Avalonia.Media.Imaging;
+using Avalonia.Platform.Storage;
+using AvaloniaApplication1.Models;
+using ReactiveUI;
+using Avalonia;
+using System.Threading;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Windows.Input;
+using System.Collections.ObjectModel;
+using Avalonia.Threading;
+
+namespace AvaloniaApplication1.ViewModels
+{
+	public class AddSmeshViewModel : ViewModelBase
+	{
+
+        string name;
+        string animal;
+        List<Gender> genders;
+        List<Property> property;
+        List<Property> property2;
+        List<Property> smeshProperty;
+        Property selectedProperty ;
+        Gender selectedGender;
+		int age;
+		Bitmap imageSmesh;
+        byte[] image;
+        public ObservableCollection<Property> Items { get; } = new ObservableCollection<Property>();
+        public ICommand AddItemCommand { get; }
+        public string Name { get=> name; set => this.RaiseAndSetIfChanged(ref name, value); }
+        public string Animal { get => animal; set => this.RaiseAndSetIfChanged(ref animal, value); }
+        public List<Gender> Genders { get => genders; set => this.RaiseAndSetIfChanged(ref genders, value); }
+        public List<Property> Property { get => property; set => this.RaiseAndSetIfChanged(ref property, value); }
+        public List<Property> Property2 { get => property; set => this.RaiseAndSetIfChanged(ref property, value); }
+        public List<Property> SmeshProperty { get => smeshProperty; set => this.RaiseAndSetIfChanged(ref smeshProperty, value); }
+        public Gender SelectedGender { get => selectedGender; set => this.RaiseAndSetIfChanged(ref selectedGender, value); }
+        public Property SelectedProperty { get => selectedProperty; set  { selectedProperty = value; AddNewItem(); } }
+        public int Age { get => age; set => this.RaiseAndSetIfChanged(ref age, value); }
+
+        public Bitmap ImageSmesh { get => imageSmesh; set => this.RaiseAndSetIfChanged(ref imageSmesh, value); }
+        public byte[] Image { get => image; set => this.RaiseAndSetIfChanged(ref image, value); }
+
+
+        public AddSmeshViewModel()
+		{
+            property = myConnection.Properties.ToList();
+            property2 = property.ToList();
+            selectedProperty = property.FirstOrDefault();
+            genders = myConnection.Genders.ToList();
+		}
+
+        public async Task AddImage()
+        {
+            if (Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop ||
+               desktop.MainWindow?.StorageProvider is not { } provider)
+                throw new NullReferenceException("Missing StorageProvider instance.");
+
+            var files = await provider.OpenFilePickerAsync(new FilePickerOpenOptions()
+            {
+                Title = "Ôîòî ñìåøàðèêà",
+                AllowMultiple = false
+            });
+            await using var readStream = await files[0].OpenReadAsync();
+            byte[] buffer = new byte[10000000];
+            var bytes = readStream.ReadAtLeast(buffer, 1);
+            Array.Resize(ref buffer, bytes);
+            Image = buffer;
+            ImageSmesh = new Bitmap(new MemoryStream(buffer));
+        }
+
+        public void Back() => MainWindowViewModel.Self.Uc = new AdminPage();
+        public void Save()
+        {
+            myConnection.Add(new Smeshariki()
+            {
+                Name = Name,
+                Age = Age,
+                Gender = SelectedGender.Id,
+                Animal = Animal,
+                Image = Image,
+                IdProperties = Items
+            });
+            myConnection.SaveChanges();
+            MainWindowViewModel.Self.Uc = new AdminPage();
+        }
+
+        private async void AddNewItem()
+        {
+            var newItem = SelectedProperty;
+            await Dispatcher.UIThread.InvokeAsync(() =>
+            {
+                if(newItem != null)
+                {
+                    Items.Add(newItem);
+                    Property = Property.Except(Items).ToList();
+                }
+            });
+        }
+        public event PropertyChangedEventHandler PropertyChanged;
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+        }
+
+
+
+
+    }
+}

+ 73 - 0
AvaloniaApplication1/ViewModels/AdminUsersViewModel.cs

@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using Avalonia.Media.Imaging;
+using AvaloniaApplication1.Models;
+using Microsoft.EntityFrameworkCore;
+using System.Linq;
+using ReactiveUI;
+
+namespace AvaloniaApplication1.ViewModels
+{
+	public class AdminUsersViewModel : ViewModelBase
+    {
+        List<User> usersMain;
+        List<User> users;
+        string search;
+        List<Gender> genders;
+        Gender selectedGender;
+        int id;
+        public AdminUsersViewModel()
+        {
+            this.usersMain = myConnection.Users.Include(x => x.GenderNavigation).ToList();
+            this.users = this.usersMain;
+            genders =
+            [
+                new Gender() { Title = "Âûáåðåòå ïîë", Id = 0 },
+            .. users.Select(x => x.GenderNavigation).Distinct().OrderBy(x=>x.Id).ToList()
+            ];
+            selectedGender = genders.Where(x => x.Id == 0).First();
+
+        }
+
+
+
+        public string Search { get => search; set { search = value; AllFilters(); } }
+        public List<Gender> Genders { get => genders; set => this.RaiseAndSetIfChanged(ref genders, value); }
+        public Gender SelectedGender { get => selectedGender; set { selectedGender = value; AllFilters(); } }
+        public List<User> Users { get => users; set => this.RaiseAndSetIfChanged(ref users, value); }
+        public List<User> UsersMain { get => usersMain; set => this.RaiseAndSetIfChanged(ref usersMain, value); }
+
+
+        public void OrderByAge(int id)
+        {
+            switch (id)
+            {
+                case 1:
+                    Users = Users.OrderBy(x => x.DateOfBirth).ToList();
+                    break;
+                case 2:
+                    Users = Users.OrderByDescending(x => x.DateOfBirth).ToList();
+                    break;
+            }
+        }
+
+
+        public void Drop(int id)
+        {
+            myConnection.Users.Remove(UsersMain.Where(x => x.Id == id).First());
+            myConnection.SaveChanges();
+            UsersMain = myConnection.Users.ToList();
+            Users = UsersMain;
+        }
+        public void Update(int id)
+        {
+            MainWindowViewModel.Self.Uc = new UpdateUsers(id);
+        }
+        private void AllFilters()
+        {
+            Users = UsersMain;
+            if (!string.IsNullOrEmpty(Search)) Users = Users.Where(x => x.LastName.ToLower().Contains(Search.ToLower())).ToList();
+            if (selectedGender != null && selectedGender.Id != 0) { Users = Users.Where(x => x.GenderNavigation == selectedGender).ToList(); }
+        }
+    }
+}

+ 27 - 0
AvaloniaApplication1/ViewModels/AdminViewModel.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using Avalonia.Controls;
+using ReactiveUI;
+
+namespace AvaloniaApplication1.ViewModels
+{
+	public class AdminViewModel : ViewModelBase
+	{
+        UserControl page = new MainPage();
+        public UserControl Page { get => page; set => this.RaiseAndSetIfChanged(ref page, value); }
+
+
+        public void toProfile()
+        {
+            Page = new AdminUsers();
+        }
+        public void toSmesh()
+        {
+            Page = new MainPage();
+        }
+        public void AddSmesh()
+        {
+            Page = new AddSmesh();
+        }
+    }
+}

+ 4 - 2
AvaloniaApplication1/ViewModels/MainPageViewModel.cs

@@ -23,7 +23,7 @@ namespace AvaloniaApplication1.ViewModels
         List<Bitmap> images;
         List<Bitmap> images;
         public MainPageViewModel()
         public MainPageViewModel()
         {
         {
-            this.smesharikiMain = myConnection.Smesharikis.Include(x => x.GenderNavigation).ToList();
+            this.smesharikiMain = myConnection.Smesharikis.Include(x => x.GenderNavigation).Include(x=>x.IdProperties).ToList();
             this.smeshariki = this.smesharikiMain;
             this.smeshariki = this.smesharikiMain;
             genders =
             genders =
             [
             [
@@ -64,7 +64,9 @@ namespace AvaloniaApplication1.ViewModels
 
 
         public void Drop(int id)
         public void Drop(int id)
         {
         {
-            myConnection.Smesharikis.Remove(SmesharikiMain.Where(x=> x.Id == id).First());
+            Smeshariki smesh =  myConnection.Smesharikis.FirstOrDefault(x => x.Id == id);
+            smesh.IdProperties = null;
+            myConnection.Smesharikis.Remove(smesh);
             myConnection.SaveChanges();
             myConnection.SaveChanges();
             SmesharikiMain = myConnection.Smesharikis.ToList();
             SmesharikiMain = myConnection.Smesharikis.ToList();
             Smeshariki = SmesharikiMain;
             Smeshariki = SmesharikiMain;

+ 1 - 1
AvaloniaApplication1/ViewModels/MainWindowViewModel.cs

@@ -41,7 +41,7 @@ namespace AvaloniaApplication1.ViewModels
                 if(user.IdRole == 2)
                 if(user.IdRole == 2)
                 {
                 {
                     Id = user.Id;
                     Id = user.Id;
-                    Uc = new UserPage();
+                    Uc = new AdminPage();
                     
                     
                 }
                 }
                 else
                 else

+ 8 - 7
AvaloniaApplication1/ViewModels/RegistrationPageViewModel - Копировать.cs

@@ -61,8 +61,8 @@ namespace AvaloniaApplication1.ViewModels
                 Info = "Заполните все поля";
                 Info = "Заполните все поля";
             }
             }
             else {
             else {
-                try
-                {
+                try { 
+                
                     Users = myConnection.Users.Where(x => x.Login == Login).ToList();
                     Users = myConnection.Users.Where(x => x.Login == Login).ToList();
                     if (Users.Count > 0)
                     if (Users.Count > 0)
                     {
                     {
@@ -72,16 +72,17 @@ namespace AvaloniaApplication1.ViewModels
                     {
                     {
                         User user = new User() { FirstName = Name, LastName = Surname, Patronymic = Patronymic, DateOfBirth = DateOfBirth, Gender = SelectedGender.Id, IdRole = 1, Login = Login, Password = Password };
                         User user = new User() { FirstName = Name, LastName = Surname, Patronymic = Patronymic, DateOfBirth = DateOfBirth, Gender = SelectedGender.Id, IdRole = 1, Login = Login, Password = Password };
                         myConnection.Users.Add(user);
                         myConnection.Users.Add(user);
-                        myConnection.SaveChanges(); 
+                        myConnection.SaveChanges();
+                        MainWindowViewModel.Self.Uc = new UserPage();
                     }
                     }
-                    
 
 
-                }
+
+            }
                 catch (Exception ex)
                 catch (Exception ex)
                 {
                 {
-                    Info = ex.Message;
-                }
+                Info = ex.Message;
             }
             }
+        }
             
             
             
             
 
 

+ 33 - 6
AvaloniaApplication1/ViewModels/UpdateSmesharikViewModel.cs

@@ -1,12 +1,17 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
+using System.Runtime.CompilerServices;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using System.Windows.Input;
 using Avalonia;
 using Avalonia;
 using Avalonia.Controls.ApplicationLifetimes;
 using Avalonia.Controls.ApplicationLifetimes;
 using Avalonia.Media.Imaging;
 using Avalonia.Media.Imaging;
 using Avalonia.Platform.Storage;
 using Avalonia.Platform.Storage;
+using Avalonia.Threading;
 using AvaloniaApplication1.Models;
 using AvaloniaApplication1.Models;
 using Microsoft.EntityFrameworkCore;
 using Microsoft.EntityFrameworkCore;
 using ReactiveUI;
 using ReactiveUI;
@@ -17,16 +22,18 @@ namespace AvaloniaApplication1.ViewModels
     {
     {
 		Smeshariki smesh;
 		Smeshariki smesh;
 		List<Gender> genders;
 		List<Gender> genders;
-		Bitmap imageSmesh;
-		public Smeshariki Smesh { get => smesh; set => this.RaiseAndSetIfChanged(ref smesh, value); }
+        Bitmap imageSmesh;
+        public ICommand DeleteItem { get; }
+        public ObservableCollection<Property> Properties { get; } = new ObservableCollection<Property>();
+        public Smeshariki Smesh { get => smesh; set => this.RaiseAndSetIfChanged(ref smesh, value); }
         public List<Gender> Genders { get => genders; set => this.RaiseAndSetIfChanged(ref genders, value); }
         public List<Gender> Genders { get => genders; set => this.RaiseAndSetIfChanged(ref genders, value); }
-		public Gender selectedGender;
+        public Gender selectedGender;
         public Gender SelectedGender { get => selectedGender; set => this.RaiseAndSetIfChanged(ref selectedGender, value); }
         public Gender SelectedGender { get => selectedGender; set => this.RaiseAndSetIfChanged(ref selectedGender, value); }
         public Bitmap ImageSmesh { get => imageSmesh; set => this.RaiseAndSetIfChanged(ref imageSmesh, value); }
         public Bitmap ImageSmesh { get => imageSmesh; set => this.RaiseAndSetIfChanged(ref imageSmesh, value); }
         public UpdateSmesharikViewModel(int id)
         public UpdateSmesharikViewModel(int id)
 		{
 		{
             Genders = myConnection.Genders.ToList();
             Genders = myConnection.Genders.ToList();
-            smesh = myConnection.Smesharikis.Include(x => x.GenderNavigation).FirstOrDefault(x=> x.Id ==id);
+            smesh = myConnection.Smesharikis.Include(x => x.GenderNavigation).Include(x=> x.IdProperties).FirstOrDefault(x=> x.Id ==id);
 			imageSmesh = Smesh.Image != null ? new Bitmap(new MemoryStream(smesh.Image)) : new Bitmap("çàãëóøêà.png");
 			imageSmesh = Smesh.Image != null ? new Bitmap(new MemoryStream(smesh.Image)) : new Bitmap("çàãëóøêà.png");
 
 
         }
         }
@@ -34,7 +41,7 @@ namespace AvaloniaApplication1.ViewModels
 		public void Save() 
 		public void Save() 
 		{
 		{
 			myConnection.SaveChanges();
 			myConnection.SaveChanges();
-			MainWindowViewModel.Self.Uc = new MainPage();
+			MainWindowViewModel.Self.Uc = new AdminPage();
 		} 
 		} 
 
 
 
 
@@ -58,7 +65,27 @@ namespace AvaloniaApplication1.ViewModels
 			myConnection.SaveChanges();
 			myConnection.SaveChanges();
         }
         }
 
 
+        public void Back() => MainWindowViewModel.Self.Uc = new AdminPage();
+
+        private async void DeleteProperty(int id)
+        {
+            var newItem = Properties.FirstOrDefault(X => X.Id == id);
+            await Dispatcher.UIThread.InvokeAsync(() =>
+            {
+                if (newItem != null)
+                {
+                    Properties.Remove(newItem);
+                }
+            });
+        }
+
+        public event PropertyChangedEventHandler PropertyChanged;
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+        }
+
 
 
 
 
-	}
+    }
 }
 }

+ 34 - 0
AvaloniaApplication1/ViewModels/UpdateUsersViewModel.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using AvaloniaApplication1.Models;
+using Microsoft.EntityFrameworkCore;
+using ReactiveUI;
+
+namespace AvaloniaApplication1.ViewModels
+{
+	public class UpdateUsersViewModel : ViewModelBase
+	{
+		User user;
+        List<Gender> genderList;
+        Gender selectedGender;
+        public User User { get => user; set => this.RaiseAndSetIfChanged(ref user, value); }
+        public List<Gender> GenderList { get => genderList; set => this.RaiseAndSetIfChanged(ref genderList, value); }
+        public Gender SelectedGender { get => selectedGender; set => this.RaiseAndSetIfChanged(ref selectedGender, value); }
+
+        public UpdateUsersViewModel(int id)
+		{
+			user = myConnection.Users.FirstOrDefault(x => x.Id == id);
+			genderList = myConnection.Genders.ToList();
+            selectedGender = genderList.FirstOrDefault(x => x.Id == user.Gender);
+        }
+
+        public DateTimeOffset DateTimeOffset
+        {
+            get => new DateTimeOffset(user.DateOfBirth, TimeSpan.Zero);
+            set => user.DateOfBirth = new DateTime(value.Year, value.Month, value.Day);
+        }
+
+        public void Back() => MainWindowViewModel.Self.Uc = new AdminPage();
+    }
+}

+ 25 - 5
AvaloniaApplication1/ViewModels/UserMainViewModel.cs

@@ -12,12 +12,22 @@ namespace AvaloniaApplication1.ViewModels
     {
     {
         User user;
         User user;
         List<Gender> genders;
         List<Gender> genders;
+        string info;
         
         
 
 
-        public User User { get => user; set => this.RaiseAndSetIfChanged(ref user, value); }
+        public User User { get => user; set {
+                Info = "";
+                user = value;
+            } }
+        public string Info { get => info; set => this.RaiseAndSetIfChanged(ref info, value); }
         public List<Gender> Genders { get => genders; set => this.RaiseAndSetIfChanged(ref genders, value); }
         public List<Gender> Genders { get => genders; set => this.RaiseAndSetIfChanged(ref genders, value); }
         public Gender selectedGender;
         public Gender selectedGender;
-        public Gender SelectedGender { get => selectedGender; set => this.RaiseAndSetIfChanged(ref selectedGender, value); }
+        public Gender SelectedGender { get => selectedGender; set
+            {
+                selectedGender = value;
+                Info = "";
+            }
+        }
 
 
         public UserMainViewModel(int id)
         public UserMainViewModel(int id)
         {
         {
@@ -30,12 +40,22 @@ namespace AvaloniaApplication1.ViewModels
         public DateTimeOffset DateTimeOffset
         public DateTimeOffset DateTimeOffset
         {
         {
             get => new DateTimeOffset(User.DateOfBirth, TimeSpan.Zero);
             get => new DateTimeOffset(User.DateOfBirth, TimeSpan.Zero);
-            set => User.DateOfBirth = new DateTime(value.Year, value.Month, value.Day);
+            set {
+                User.DateOfBirth = new DateTime(value.Year, value.Month, value.Day);
+                Info = "";
+            }
         }
         }
         public void Save()
         public void Save()
         {
         {
-            myConnection.SaveChanges();
-            MainWindowViewModel.Self.Uc = new MainPage();
+            try
+            {
+                myConnection.SaveChanges();
+                Info = "Äàííûå óñïåøíî ñîõðàíåíû";
+            }
+            catch (Exception ex)
+            {
+                Info = $"Îøèáêà: {ex.Message}";
+            }
         }
         }
     }
     }
 }
 }

+ 46 - 0
AvaloniaApplication1/Views/AddSmesh.axaml

@@ -0,0 +1,46 @@
+<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"
+             x:Class="AvaloniaApplication1.AddSmesh"
+			 xmlns:vm="using:AvaloniaApplication1.ViewModels"
+			 x:DataType="vm:AddSmeshViewModel">
+	
+		<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
+			<StackPanel Orientation="Vertical">
+				<Image Source="{Binding ImageSmesh}" Width="100" Height="100"/>
+				<TextBlock Text="Имя" Margin="0 5"/>
+				<TextBox  Text="{Binding Name}" Watermark="Введите имя"  Margin="0 5"/>
+				<TextBlock Text="Возраст" Margin="0 5"/>
+				<TextBox  Text="{Binding Age}" Watermark="Введите возраст"  Margin="0 5"/>
+				<TextBlock Text="Животное" Margin="0 5"/>
+				<TextBox  Text="{Binding Animal}" Watermark="Введите животное"  Margin="0 5"/>
+				<TextBlock Text="Выберете пол: " Margin="0 5"/>
+				<ComboBox ItemsSource="{Binding Genders}" SelectedItem="{Binding SelectedGender}" Width="150">
+					<ComboBox.ItemTemplate>
+						<DataTemplate>
+							<TextBlock Text="{Binding Title}"/>
+						</DataTemplate>
+					</ComboBox.ItemTemplate>
+				</ComboBox>
+				<TextBlock Text="Выберете качества: " Margin="0 5"/>
+				<ComboBox ItemsSource="{Binding Property}" SelectedItem="{Binding SelectedProperty}" Width="150">
+					<ComboBox.ItemTemplate>
+						<DataTemplate>
+							<TextBlock Text="{Binding Title}"/>
+						</DataTemplate>
+					</ComboBox.ItemTemplate>
+				</ComboBox>
+				<Button Content="Добавить фото" Command="{Binding AddImage}" Margin="0 5" Width="150"/>
+				<Button Content="Сохранить" Command="{Binding Save}" Margin="0 5" Width="150"/>
+			</StackPanel>
+				<ListBox ItemsSource="{Binding Items}" Width="150" Height="300">
+					<ListBox.ItemTemplate>
+						<DataTemplate>
+							<TextBlock Text="{Binding Title}" Foreground="Black"/>
+						</DataTemplate>
+					</ListBox.ItemTemplate>
+				</ListBox>
+		</StackPanel>
+</UserControl>

+ 15 - 0
AvaloniaApplication1/Views/AddSmesh.axaml.cs

@@ -0,0 +1,15 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+using AvaloniaApplication1.ViewModels;
+
+namespace AvaloniaApplication1;
+
+public partial class AddSmesh : UserControl
+{
+    public AddSmesh()
+    {
+        InitializeComponent();
+        DataContext = new AddSmeshViewModel();
+    }
+}

+ 19 - 0
AvaloniaApplication1/Views/AdminPage.axaml

@@ -0,0 +1,19 @@
+<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"
+             x:Class="AvaloniaApplication1.AdminPage"
+			 xmlns:vm="using:AvaloniaApplication1.ViewModels"
+			 x:DataType="vm:AdminViewModel">
+	<Grid RowDefinitions="50,*,50" ColumnDefinitions="200,*" >
+		<StackPanel Grid.Column="0" Grid.Row="1">
+			<Button Content="Пользователи" Command="{Binding toProfile}"/>
+			<Button Content="Смешарики" Command="{Binding toSmesh}"/>
+			<Button Content="Добавить персонажа" Command="{Binding AddSmesh}"/>
+		</StackPanel>
+		<TextBlock Text="Шарарам" Grid.ColumnSpan="2" HorizontalAlignment="Center"	VerticalAlignment="Center" Foreground="Yellow" FontSize="30" FontWeight="Black"></TextBlock>
+		<TextBlock Text="Персонажи"  HorizontalAlignment="Center"  FontSize="30"> </TextBlock>
+		<ContentControl Content="{Binding Page}" Grid.Column="1" Grid.Row="1"/>
+	</Grid>
+</UserControl>

+ 15 - 0
AvaloniaApplication1/Views/AdminPage.axaml.cs

@@ -0,0 +1,15 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+using AvaloniaApplication1.ViewModels;
+
+namespace AvaloniaApplication1;
+
+public partial class AdminPage : UserControl
+{
+    public AdminPage()
+    {
+        InitializeComponent();
+        DataContext = new AdminViewModel();
+    }
+}

+ 42 - 0
AvaloniaApplication1/Views/AdminUsers.axaml

@@ -0,0 +1,42 @@
+<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"
+             x:Class="AvaloniaApplication1.AdminUsers"
+			 xmlns:vm="using:AvaloniaApplication1.ViewModels"
+			 x:DataType="vm:AdminUsersViewModel">
+	<Grid RowDefinitions="50,*" Grid.Column="1" Grid.Row="1">
+		<StackPanel Orientation="Horizontal">
+			<TextBox Text="{Binding Search}" Width="200" Watermark="Введите имя: "></TextBox>
+			<ComboBox ItemsSource="{Binding Genders}" SelectedItem="{Binding SelectedGender}">
+				<ComboBox.ItemTemplate>
+					<DataTemplate>
+						<TextBlock Text="{Binding Title}"/>
+					</DataTemplate>
+				</ComboBox.ItemTemplate>
+			</ComboBox>
+			<StackPanel Orientation="Horizontal">
+				<RadioButton Content="По возрастанию" Command="{Binding OrderByAge}" CommandParameter="1"></RadioButton>
+				<RadioButton Content="По убыванию" Command="{Binding OrderByAge}" CommandParameter="2"></RadioButton>
+			</StackPanel>
+		</StackPanel>
+		<ListBox ItemsSource="{Binding Users}" Grid.Row="1">
+			<ListBox.ItemTemplate>
+				<DataTemplate>
+					<StackPanel Orientation="Horizontal">
+						<StackPanel>
+							<TextBlock Text="{Binding LastName, StringFormat= Фамилия: {0}}"></TextBlock>
+							<TextBlock Text="{Binding FirstName, StringFormat= Имя: {0}}"></TextBlock>
+							<TextBlock Text="{Binding Patronymic, StringFormat= Отчество: {0}}"></TextBlock>
+							<TextBlock Text="{Binding DateOfBirth, StringFormat= Дата рождения: {0:dd.MM.yyyy}}"></TextBlock>
+							<TextBlock Text="{Binding GenderNavigation.Title, StringFormat= Пол: {0}}"></TextBlock>
+							<Button Content="Удалить" Command="{Binding $parent[UserControl].((vm:AdminUsersViewModel)DataContext).Drop}" CommandParameter="{Binding Id}"/>
+							<Button Content="Изменить" Command="{Binding $parent[UserControl].((vm:AdminUsersViewModel)DataContext).Update}" CommandParameter="{Binding Id}"/>
+						</StackPanel>
+					</StackPanel>
+				</DataTemplate>
+			</ListBox.ItemTemplate>
+		</ListBox>
+	</Grid>
+</UserControl>

+ 15 - 0
AvaloniaApplication1/Views/AdminUsers.axaml.cs

@@ -0,0 +1,15 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+using AvaloniaApplication1.ViewModels;
+
+namespace AvaloniaApplication1;
+
+public partial class AdminUsers : UserControl
+{
+    public AdminUsers()
+    {
+        InitializeComponent();
+        DataContext = new AdminUsersViewModel();
+    }
+}

+ 39 - 35
AvaloniaApplication1/Views/MainPage.axaml

@@ -5,29 +5,33 @@
              mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
              mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
              x:Class="AvaloniaApplication1.MainPage"
              x:Class="AvaloniaApplication1.MainPage"
 			 xmlns:vm="using:AvaloniaApplication1.ViewModels"
 			 xmlns:vm="using:AvaloniaApplication1.ViewModels"
-			 x:DataType="vm:MainPageViewModel">
+			 x:DataType="vm:MainPageViewModel"
+			 xmlns:conv="using:AvaloniaApplication1.Resources">
 
 
-		<Grid RowDefinitions="50,*,50" ColumnDefinitions="200,*" >
-			<TextBlock Text="Шарарам" Grid.ColumnSpan="" HorizontalAlignment="Center"	VerticalAlignment="Center" Foreground="Yellow" FontSize="30" FontWeight="Black"></TextBlock>
-			<TextBlock Text="Персонажи"  HorizontalAlignment="Center"  FontSize="30"> </TextBlock>
-			<Grid RowDefinitions="50,*" ColumnDefinitions="600,*" Grid.Column="1" Grid.Row="1">
-				<StackPanel Orientation="Horizontal">
-					<TextBox Text="{Binding Search}" Width="200" Watermark="Введите имя: "></TextBox>
-					<ComboBox ItemsSource="{Binding Genders}" SelectedItem="{Binding SelectedGender}">
-						<ComboBox.ItemTemplate>
-							<DataTemplate>
-								<TextBlock Text="{Binding Title}"/>
-							</DataTemplate>
-						</ComboBox.ItemTemplate>
-					</ComboBox>
+	<UserControl.Resources>
+		<conv:ImageConverter x:Key="myImageConverter"/>
+	</UserControl.Resources>
+	<Grid RowDefinitions="50,*" Grid.Column="1" Grid.Row="1">
+		<StackPanel Orientation="Horizontal">
+			<TextBox Text="{Binding Search}" Width="200" Watermark="Введите имя: "></TextBox>
+			<ComboBox ItemsSource="{Binding Genders}" SelectedItem="{Binding SelectedGender}">
+				<ComboBox.ItemTemplate>
+					<DataTemplate>
+						<TextBlock Text="{Binding Title}"/>
+					</DataTemplate>
+				</ComboBox.ItemTemplate>
+			</ComboBox>
+			<StackPanel Orientation="Horizontal">
+				<RadioButton Content="По возрастанию" Command="{Binding OrderByAge}" CommandParameter="1"></RadioButton>
+				<RadioButton Content="По убыванию" Command="{Binding OrderByAge}" CommandParameter="2"></RadioButton>
+			</StackPanel>
+		</StackPanel>
+		<ListBox ItemsSource="{Binding Smeshariki}" Grid.Row="1">
+			<ListBox.ItemTemplate>
+				<DataTemplate>
 					<StackPanel Orientation="Horizontal">
 					<StackPanel Orientation="Horizontal">
-						<RadioButton Content="По возрастанию" Command="{Binding OrderByAge}" CommandParameter="1"></RadioButton>
-						<RadioButton Content="По убыванию" Command="{Binding OrderByAge}" CommandParameter="2"></RadioButton>
-					</StackPanel>
-				</StackPanel>
-				<ListBox ItemsSource="{Binding Smeshariki}" Grid.Row="1" >
-					<ListBox.ItemTemplate>
-						<DataTemplate>
+						<Image Source="{Binding Image, Converter= {StaticResource myImageConverter}}" Width="100" Height="100"/>
+						<StackPanel Orientation="Horizontal">
 							<StackPanel>
 							<StackPanel>
 								<TextBlock Text="{Binding Name, StringFormat= Имя: {0}}"></TextBlock>
 								<TextBlock Text="{Binding Name, StringFormat= Имя: {0}}"></TextBlock>
 								<TextBlock Text="{Binding Animal, StringFormat= Животное: {0}}"></TextBlock>
 								<TextBlock Text="{Binding Animal, StringFormat= Животное: {0}}"></TextBlock>
@@ -36,18 +40,18 @@
 								<Button Content="Удалить" Command="{Binding $parent[UserControl].((vm:MainPageViewModel)DataContext).Drop}" CommandParameter="{Binding Id}"/>
 								<Button Content="Удалить" Command="{Binding $parent[UserControl].((vm:MainPageViewModel)DataContext).Drop}" CommandParameter="{Binding Id}"/>
 								<Button Content="Изменить" Command="{Binding $parent[UserControl].((vm:MainPageViewModel)DataContext).Update}" CommandParameter="{Binding Id}"/>
 								<Button Content="Изменить" Command="{Binding $parent[UserControl].((vm:MainPageViewModel)DataContext).Update}" CommandParameter="{Binding Id}"/>
 							</StackPanel>
 							</StackPanel>
-						</DataTemplate>
-					</ListBox.ItemTemplate>
-				</ListBox>
-				<ListBox ItemsSource="{Binding Images}" Grid.Row="1" Grid.Column="1">
-					<ListBox.ItemTemplate>
-						<DataTemplate>
-							<StackPanel>
-								<Image Source=""/>
-							</StackPanel>
-						</DataTemplate>
-					</ListBox.ItemTemplate>
-				</ListBox>
-			</Grid>
-		</Grid>
+							<ListBox ItemsSource="{Binding IdProperties}" Width="150" IsVisible="{Binding IdProperties.Count}">
+								<ListBox.ItemTemplate>
+									<DataTemplate>
+										<TextBlock Text="{Binding Title}" Foreground="Black"/>
+									</DataTemplate>
+								</ListBox.ItemTemplate>
+								
+							</ListBox>
+						</StackPanel>
+					</StackPanel>
+				</DataTemplate>
+			</ListBox.ItemTemplate>
+		</ListBox>
+	</Grid>
 </UserControl>
 </UserControl>

+ 0 - 2
AvaloniaApplication1/Views/MainPage.axaml.cs

@@ -1,9 +1,7 @@
 using Avalonia;
 using Avalonia;
 using Avalonia.Controls;
 using Avalonia.Controls;
 using Avalonia.Markup.Xaml;
 using Avalonia.Markup.Xaml;
-using AvaloniaApplication1.Models;
 using AvaloniaApplication1.ViewModels;
 using AvaloniaApplication1.ViewModels;
-using System.Collections.Generic;
 
 
 namespace AvaloniaApplication1;
 namespace AvaloniaApplication1;
 
 

+ 1 - 0
AvaloniaApplication1/Views/ProfileUser.axaml

@@ -21,6 +21,7 @@
 
 
 		<DatePicker SelectedDate="{Binding DateTimeOffset}"/>
 		<DatePicker SelectedDate="{Binding DateTimeOffset}"/>
 		<Button Content="Сохранить" Command="{Binding Save}"/>
 		<Button Content="Сохранить" Command="{Binding Save}"/>
+		<TextBlock Text="{Binding Info}"/>
 
 
 	</StackPanel>
 	</StackPanel>
 </UserControl>
 </UserControl>

+ 37 - 19
AvaloniaApplication1/Views/UpdateSmesharik.axaml

@@ -6,26 +6,44 @@
              x:Class="AvaloniaApplication1.UpdateSmesharik"
              x:Class="AvaloniaApplication1.UpdateSmesharik"
 			 xmlns:vm="using:AvaloniaApplication1.ViewModels"
 			 xmlns:vm="using:AvaloniaApplication1.ViewModels"
 			 x:DataType="vm:UpdateSmesharikViewModel">
 			 x:DataType="vm:UpdateSmesharikViewModel">
-	<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
-		<Image Source="{Binding ImageSmesh}" Width="100" Height="100"/>
-		<TextBlock Text="Имя:" Margin="0 5"/>
-		<TextBox Text="{Binding Smesh.Name}"/>
-		<TextBlock Text="Возраст:" Margin="0 5"/>
-		<TextBox Text="{Binding Smesh.Age}" />
-		<TextBlock Text="Пол: " Margin="0 5"/>
-		<ComboBox ItemsSource="{Binding Genders}" SelectedItem="{Binding Smesh.GenderNavigation}">
-			<ComboBox.ItemTemplate>
-				<DataTemplate>
-					<TextBlock Text="{Binding Title}"/>
-				</DataTemplate>
-			</ComboBox.ItemTemplate>
-		</ComboBox>
-		<TextBlock Text="Животное:" Margin="0 5"/>
-		<TextBox Text="{Binding Smesh.Animal}" />
+	<StackPanel>
+		<StackPanel>
+			<Button Content="Назад" Command="{Binding Back}"/>
+		</StackPanel>
+		<StackPanel Orientation="Horizontal">
+			<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
+				<Image Source="{Binding ImageSmesh}" Width="100" Height="100"/>
+				<TextBlock Text="Имя:" Margin="0 5"/>
+				<TextBox Text="{Binding Smesh.Name}"/>
+				<TextBlock Text="Возраст:" Margin="0 5"/>
+				<TextBox Text="{Binding Smesh.Age}" />
+				<TextBlock Text="Пол: " Margin="0 5"/>
+				<ComboBox ItemsSource="{Binding Genders}" SelectedItem="{Binding Smesh.GenderNavigation}">
+					<ComboBox.ItemTemplate>
+						<DataTemplate>
+							<TextBlock Text="{Binding Title}"/>
+						</DataTemplate>
+					</ComboBox.ItemTemplate>
+				</ComboBox>
+				<TextBlock Text="Животное:" Margin="0 5"/>
+				<TextBox Text="{Binding Smesh.Animal}" />
 
 
-		<Button Content="Изменить фото смешарика" Command="{Binding Image}"/>
-		<Button Content="Сохранить" Command="{Binding Save}"/>
-		
+				<Button Content="Изменить фото смешарика" Command="{Binding Image}"/>
+				<Button Content="Сохранить" Command="{Binding Save}"/>
+
+			</StackPanel>
+			<ListBox ItemsSource="{Binding Smesh.IdProperties}" Width="150" Height="300">
+				<ListBox.ItemTemplate>
+					<DataTemplate>
+						<StackPanel Orientation="Horizontal">
+							<Button Content="-" Command="{Binding $parent[UserControl].((vm:UpdateSmesharikViewModel)DataContext).DeleteProperty}" CommandParameter="{Binding Id}"/>
+							<TextBlock Text="{Binding Title}" Foreground="Black"/>
+						</StackPanel>
+					</DataTemplate>
+				</ListBox.ItemTemplate>
+			</ListBox>
+			
+		</StackPanel>
 	</StackPanel>
 	</StackPanel>
 
 
 </UserControl>
 </UserControl>

+ 43 - 0
AvaloniaApplication1/Views/UpdateUsers.axaml

@@ -0,0 +1,43 @@
+<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"
+             x:Class="AvaloniaApplication1.UpdateUsers"
+			  xmlns:vm="using:AvaloniaApplication1.ViewModels"
+			 x:DataType="vm:UpdateUsersViewModel">
+	<StackPanel>
+		<StackPanel>
+			<Button Content="Назад" Command="{Binding Back}"/>
+		</StackPanel>
+		<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+			<TextBlock Text="Фамилия:" Margin="0 5"/>
+			<TextBox Text="{Binding User.LastName}" Watermark=" Введите фамилию"/>
+			<TextBlock Text="Имя:" Margin="0 5"/>
+			<TextBox Text="{Binding User.FirstName}" Watermark="Введите имя"/>
+			<TextBlock Text="Отчеcтво:" Margin="0 5"/>
+			<TextBox Text="{Binding User.Patronymic}" Watermark="Введите отчество"/>
+
+			<TextBlock Text="Пол: " Margin="0 5"/>
+			<ComboBox ItemsSource="{Binding GenderList}" SelectedItem="{Binding SelectedGender}">
+				<ComboBox.ItemTemplate>
+					<DataTemplate>
+						<TextBlock Text="{Binding Title}"/>
+					</DataTemplate>
+				</ComboBox.ItemTemplate>
+			</ComboBox>
+
+			<TextBlock Text="Введите дату рождения: " Margin="0 5"/>
+			<DatePicker SelectedDate="{Binding DateTimeOffset}"/>
+
+			<TextBlock Text="Логин" Margin="0 5"/>
+			<TextBox  Text="{Binding User.Login}" Watermark="Введите логин"  Margin="0 5"/>
+
+
+			<TextBlock Text="Пароль" Margin="0 5"/>
+			<TextBox  Text="{Binding User.Password}" Watermark="Введите пароль" PasswordChar="*" Margin="0 5"/>
+
+
+		</StackPanel>
+	</StackPanel>
+</UserControl>

+ 15 - 0
AvaloniaApplication1/Views/UpdateUsers.axaml.cs

@@ -0,0 +1,15 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+using AvaloniaApplication1.ViewModels;
+
+namespace AvaloniaApplication1;
+
+public partial class UpdateUsers : UserControl
+{
+    public UpdateUsers(int id)
+    {
+        InitializeComponent();
+        DataContext = new UpdateUsersViewModel(id);
+    }
+}

+ 1 - 1
AvaloniaApplication1/Views/UserPage.axaml

@@ -9,7 +9,7 @@
 	<Grid RowDefinitions="50,*,50" ColumnDefinitions="200,*" >
 	<Grid RowDefinitions="50,*,50" ColumnDefinitions="200,*" >
 		<StackPanel Grid.Column="0" Grid.Row="1">
 		<StackPanel Grid.Column="0" Grid.Row="1">
 			<Button Content="Профиль" Command="{Binding toProfile}"/>
 			<Button Content="Профиль" Command="{Binding toProfile}"/>
-			<Button Content="Смешарики"/>
+			<Button Content="Смешарики" Command="{Binding toSmesh}"/>
 		</StackPanel>
 		</StackPanel>
 		<TextBlock Text="Шарарам" Grid.ColumnSpan="2" HorizontalAlignment="Center"	VerticalAlignment="Center" Foreground="Yellow" FontSize="30" FontWeight="Black"></TextBlock>
 		<TextBlock Text="Шарарам" Grid.ColumnSpan="2" HorizontalAlignment="Center"	VerticalAlignment="Center" Foreground="Yellow" FontSize="30" FontWeight="Black"></TextBlock>
 		<TextBlock Text="Персонажи"  HorizontalAlignment="Center"  FontSize="30"> </TextBlock>
 		<TextBlock Text="Персонажи"  HorizontalAlignment="Center"  FontSize="30"> </TextBlock>

+ 1 - 0
AvaloniaApplication1/db.txt

@@ -0,0 +1 @@
+dotnet ef dbcontext scaffold "Host=edu.pg.ngknn.local;Port=5432;Database=bobarik41p;Username=31P;Password=12345" Npgsql.EntityFrameworkCore.PostgreSQL -o Models -f --no-build