Ejemplo n.º 1
0
        public void EditExecute(object param)
        {
            var v  = new BearbeiteProduktCTL();
            var vm = new BearbeiteAddVMODELProdukt();

            vm.Prod         = SelectedProdukt;
            vm.IsInEditMode = true;
            v.DataContext   = vm;
            v.ShowDialog();
            if (v.DialogResult == true)
            {
                using (SnackEmDBEntities db = new SnackEmDBEntities())
                {
                    db.Entry(vm.Prod).State = EntityState.Modified;
                    db.SaveChanges();
                    PropertyChanged(this, new PropertyChangedEventArgs("AlleProdukte"));
                }
            }
        }
Ejemplo n.º 2
0
 public void NewExecute(object param)
 {
     if (SelectedProdukt != null)
     {
         var v  = new BearbeiteProduktCTL();
         var vm = new BearbeiteAddVMODELProdukt();
         vm.Prod         = new PRODUKT();
         vm.IsInEditMode = false;
         v.DataContext   = vm;
         v.ShowDialog();
         if (v.DialogResult == true)
         {
             using (SnackEmDBEntities db = new SnackEmDBEntities())
             {
                 db.PRODUKTs.Add(vm.Prod);
                 db.SaveChanges();
                 PropertyChanged(this, new PropertyChangedEventArgs("AlleProdukte"));
             }
         }
     }
 }