//Save
        public void SaveExecuteT(object param)
        {
            var v  = new VNeuTopfW();
            var vm = new VMNeuTopf();

            vm.To           = GewaehlterTopf;
            vm.IsInEditMode = true;
            v.DataContext   = vm;           //  view.DataContext = ViewModel
            v.ShowDialog();

            if (v.DialogResult == true)
            {
                using (FloraEntities db = new FloraEntities())
                {
                    db.Entry(vm.To).State = EntityState.Modified;
                    db.SaveChanges();
                    PropertyChanged(this, new PropertyChangedEventArgs("TopfStandort"));
                }
            }
        }
        //Neu
        public void NewExecuteT(object param)
        {
            var v  = new VNeuTopfW();
            var vm = new VMNeuTopf();

            vm.To           = new Topf();
            vm.IsInEditMode = false;
            v.DataContext   = vm;           //  view.DataContext = ViewModel
            v.ShowDialog();

            if (v.DialogResult == true)
            {
                using (FloraEntities db = new FloraEntities())
                {
                    db.Topfs.Add(vm.To);
                    db.SaveChanges();
                    PropertyChanged(this, new PropertyChangedEventArgs("TopfStandort")); //GewaehlteStandortGui ???
                }
            }
        }
Example #3
0
        //Neu
        public void NewExecute(object param)
        {
            if (SelectedTopf != null)
            {
                var v  = new VNeuTopfW();
                var vm = new VMNeuTopf();
                vm.To           = new Topf();
                vm.IsInEditMode = false;
                v.DataContext   = vm;           //  view.DataContext = ViewModel
                v.ShowDialog();

                if (v.DialogResult == true)
                {
                    using (FloraEntities db = new FloraEntities())
                    {
                        db.Topfs.Add(vm.To);
                        db.SaveChanges();
                        PropertyChanged(this, new PropertyChangedEventArgs("AlleTopfe"));
                    }
                }
            }
        }