Beispiel #1
0
 private void IzmeniNamestaj_Click(object sender, RoutedEventArgs e)
 {
     if (IzabraniNamestaj != null)
     {
         Namestaj n = new Namestaj(IzabraniNamestaj);
         dodaj = false;
         DodajNamestajProzor dodajNamestaj = new DodajNamestajProzor(n);
         dodajNamestaj.ShowDialog();
         if (dodaj)
         {
             using (var unitOfWork = new Context())
             {
                 Namestaj izBaze = unitOfWork.Namestaji.Find(IzabraniNamestaj.ID);
                 if (izBaze != null)
                 {
                     izBaze.Zameni(n);
                     unitOfWork.SaveChanges();
                 }
             }
             Refresh();
         }
     }
     else
     {
         MessageBox.Show("Niste izabrali namestaj.");
     }
 }