public void DeleteExecute(object param)
 {
     if (SelectedPosition != null)
     {
         using (SnackEmDBEntities db = new SnackEmDBEntities())
         {
             db.Entry(SelectedPosition).State = EntityState.Deleted;
             db.SaveChanges();
             PropertyChanged(this, new PropertyChangedEventArgs("AllePositionen"));
         }
     }
 }
 public void DeleteExecutePos(object param)
 {
     // Delete Button was pressed
     if (SelectedPosition != null)
     {
         using (SnackEmDBEntities db = new SnackEmDBEntities())
         {
             db.Entry(SelectedPosition).State = EntityState.Deleted;
             db.SaveChanges();
             PropertyChanged(this, new PropertyChangedEventArgs("AutomatPositions"));
         }
     }
 }
        public void EditExecute(object param)
        {
            var v  = new BearbeitePositionCTL();
            var vm = new BearbeiteAddVMODELPosition();

            vm.Pos          = SelectedPosition;
            vm.IsInEditMode = true;
            v.DataContext   = vm;
            v.ShowDialog();
            if (v.DialogResult == true)
            {
                using (SnackEmDBEntities db = new SnackEmDBEntities())
                {
                    db.Entry(vm.Pos).State = EntityState.Modified;
                    db.SaveChanges();
                    PropertyChanged(this, new PropertyChangedEventArgs("AllePositionen"));
                }
            }
        }
Esempio n. 4
0
 public void EditExecuteProd(object param)
 {
     if (SelectedKategorie != null)
     {
         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"));
             }
         }
     }
 }
 public void EditExecuteAuto(object param)
 {
     //Edit Button was pressed
     if (SelectedAutomat != null)
     {
         var v  = new BearbeiteAutomatenCTL();
         var vm = new BearbeiteAddVMODELAutomat();
         vm.Auto         = SelectedAutomat;
         vm.IsInEditMode = true;
         v.DataContext   = vm;
         v.ShowDialog();
         if (v.DialogResult == true)
         {
             using (SnackEmDBEntities db = new SnackEmDBEntities())
             {
                 db.Entry(vm.Auto).State = EntityState.Modified;
                 db.SaveChanges();
                 PropertyChanged(this, new PropertyChangedEventArgs("AlleAutomaten"));
             }
         }
     }
 }