Selaa lähdekoodia

--Я в шоке, в шоке

СазоноваАА 10 kuukautta sitten
vanhempi
commit
7a305c2804

+ 2 - 1
Practikaoy/ViewModels/AuthPageViewModel.cs

@@ -9,7 +9,7 @@ namespace Practikaoy.ViewModels
 	{ Sazonova2Context ConnectBD = new Sazonova2Context();
 		string _log;
 		string _pas;
-		int _port;
+		//int _port;
 		public string Loginn
 		{
 			  get =>  _log; set => _log = value;  
@@ -18,6 +18,7 @@ namespace Practikaoy.ViewModels
 		{
 			get => _pas; set => _pas = value;
 		}
+
 		 public bool PiklsPerson (ref int ex)
 		{
 			foreach(User item in ConnectBD.Users)

+ 19 - 12
Practikaoy/ViewModels/MainWindowViewModel.cs

@@ -8,39 +8,46 @@ namespace Practikaoy.ViewModels
 {
     public class MainWindowViewModel : ViewModelBase
     {
+       
         Sazonova2Context ConnectBD = new Sazonova2Context();
         AuthPageViewModel _authPage = new AuthPageViewModel();
-        MeRoomViewModel _meRoom = new MeRoomViewModel(1);
+       
         UserControl canic = new AuthPas();
         public UserControl Canic
         {
             get => canic;
             set => this.RaiseAndSetIfChanged(ref canic, value);
-        }
-       // UserControl _uthP = new MeRoomViewModel();
+        } 
+        MeRoomViewModel _meRoom = new MeRoomViewModel(1);
+        UserControl _root = new MeRoom();
+ 
         public MeRoomViewModel MeRoom { get => _meRoom; set => _meRoom = value; } 
         public AuthPageViewModel AuthPage { get => _authPage; set => _authPage = value; }
         public UserControl USE { get => canic; set => this.RaiseAndSetIfChanged(ref canic, value); }
 
-        public void NextPage()
+        public void NaxtPage()
+        {
+            USE = new MeRoom();
+        }
+        public void PsssNext()
         {
-            int ex = 0;
-            if (AuthPage.PiklsPerson(ref ex))
+            int id = 0;
+            if (AuthPage.PiklsPerson(ref id))
             {
-                _meRoom = new MeRoomViewModel(ex);
+                _meRoom = new MeRoomViewModel(id);
                 USE = new MeRoom();
             }
-            else { USE = new AuthPas(); }
+            else
+                USE = new MeRoom();
         }
-        public void PreviousPage() 
-        { 
-        MeRoom.IsEnableEdit = true;
+        public void EndintRoom()
+        {
+            MeRoom.UserisChanged = true;
         }
 
 
 
 
 
-
     }
 }

+ 22 - 2
Practikaoy/ViewModels/MeRoomViewModel.cs

@@ -1,5 +1,7 @@
 using System;
 using System.Collections.Generic;
+using System.Linq;
+using Microsoft.EntityFrameworkCore;
 using Practikaoy.Models;
 using ReactiveUI;
 
@@ -7,9 +9,27 @@ namespace Practikaoy.ViewModels
 {
 	public class MeRoomViewModel : ReactiveObject
 	{
-        Sazonova2Context ConnectBD = new Sazonova2Context();
+       Sazonova2Context ConnectBD = new Sazonova2Context();
         User? _Useris;
+        bool _UserisChanged = false;
+        public bool _UserisChangedEnd;
+        public List<string> GendersList => new List<string>() { "Ì", "Æ" };
         public User UserIS { get => _Useris; set => _Useris = value; }
+        public bool UserisChanged { get => _UserisChanged; set => this.RaiseAndSetIfChanged(ref _UserisChanged, value); }
+        public bool UserisChangedEnd { get => _UserisChangedEnd; set => this.RaiseAndSetIfChanged(ref _UserisChangedEnd, value); }
+
+        
+        public MeRoomViewModel(int id)
+        {
+            UserIS = ConnectBD.Users.Include(x => x.IdRoleNavigation).Include(x => x.IdUserNavigation.IdGenderNavigation).FirstOrDefault(x => x.IdUser == id); 
+        }
+        
+
+
+
 
     }
-}
+}
+
+
+    

+ 3 - 3
Practikaoy/Views/AuthPas.axaml

@@ -11,10 +11,10 @@
 		<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Background="#ffa69e" Width="280" Height="150" >
 		<TextBlock />
 		<TextBlock Text="Логин" Foreground="#864639" HorizontalAlignment="Center"/>
-		<TextBox Background="#fae1dd" Width="100" />
+		<TextBox Text="{Binding AuthPage.Loginn}" Background="#fae1dd" Width="100" />
 		<TextBlock Text="Пароль" Foreground="#864639" HorizontalAlignment="Center"/>
-		<TextBox Background="#fae1dd" Width="130"/>
-		<Button Content="Вход" Padding="5" Margin="6" HorizontalAlignment="Center" Background="#ff6368"/>
+		<TextBox Text="{Binding AuthPage.Pass}" Background="#fae1dd" Width="130"/>
+		<Button Content="Вход" Command="{Binding PsssNext}" Padding="5" Margin="6" HorizontalAlignment="Center" Background="#ff6368"/>
 	</StackPanel>
 	</Border>
 	</Grid>

+ 1 - 1
Practikaoy/Views/MainWindow.axaml

@@ -14,6 +14,6 @@
              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 USE} " ></ContentControl>
+	<ContentControl Content ="{Binding USE}" />
 	
 </Window>