Beispiel #1
0
        public void EditExecute(object param)
        {
            var v  = new BearbeiteKontrolleCTL();
            var vm = new BearbeiteAddVMODELKontrolle();

            vm.Kont         = SelectedKontrolle;
            vm.IsInEditMode = true;
            v.DataContext   = vm;
            v.ShowDialog();
            if (v.DialogResult == true)
            {
                using (SnackEmDBEntities db = new SnackEmDBEntities())
                {
                    db.Entry(vm.Kont).State = EntityState.Modified;
                    db.SaveChanges();
                    PropertyChanged(this, new PropertyChangedEventArgs("AlleKontrollen"));
                }
            }
        }
Beispiel #2
0
 public void NewExecute(object param)
 {
     if (SelectedKontrolle != null)
     {
         var v  = new BearbeiteKontrolleCTL();
         var vm = new BearbeiteAddVMODELKontrolle();
         vm.Kont         = new KONTROLLE();
         vm.IsInEditMode = false;
         v.DataContext   = vm;
         v.ShowDialog();
         if (v.DialogResult == true)
         {
             using (SnackEmDBEntities db = new SnackEmDBEntities())
             {
                 db.KONTROLLEs.Add(vm.Kont);
                 db.SaveChanges();
                 PropertyChanged(this, new PropertyChangedEventArgs("AlleKontrollen"));
             }
         }
     }
 }