gr672_lii 5 gadi atpakaļ
vecāks
revīzija
080fa26252

+ 2 - 1
CopyCenter/RegistrationWindow.xaml.cs

@@ -19,7 +19,7 @@ namespace CopyCenter
     /// </summary>
     public partial class RegistrationWindow : Window
     {
-        gr672_liiEntities db = new gr672_liiEntities();
+        gr672_liiEntities db;
         public RegistrationWindow()
         {
             InitializeComponent();
@@ -47,6 +47,7 @@ namespace CopyCenter
                 ContactNumber = Convert.ToInt32(contactnumber.Text)
             };
             db.User.Add(newUser);
+            db.SaveChanges();
             MessageBox.Show("Вы успешно зарегистрировались!");
             AuthorizationWindow aw = new AuthorizationWindow();
             aw.Show();

+ 5 - 1
CopyCenter/ServicesWindow.xaml.cs

@@ -19,7 +19,7 @@ namespace CopyCenter
     /// </summary>
     public partial class ServicesWindow : Window
     {
-        gr672_liiEntities db = new gr672_liiEntities();
+        gr672_liiEntities db;
         public ServicesWindow()
         {
             InitializeComponent();
@@ -40,6 +40,8 @@ namespace CopyCenter
             service.DescriptionService = Description.Text;
             service.idCategory = Convert.ToInt32(idCategory.Text);
             db.Service.Add(service);
+            db.SaveChanges();
+            ServicesList.ItemsSource = db.Service.ToList();
         }
 
         private void Update(object sender, RoutedEventArgs e)
@@ -49,6 +51,8 @@ namespace CopyCenter
             uRow.PriceService = Convert.ToInt32(Price.Text);
             uRow.DescriptionService = Description.Text;
             uRow.idCategory = Convert.ToInt32(idCategory.Text);
+            db.SaveChanges();
+            ServicesList.ItemsSource = db.Service.ToList();
         }
         private void Window_Loaded(object sender, RoutedEventArgs e)
         {