예제 #1
0
        public void Common()
        {
            var c  = 0;
            var vm = new ActionVM {
                Metadata =
                {
                    ActionProvider       =
                    {
                        ExecutedCallback = delegate(object sender, ExecutedEventArgs args) {
                            Assert.AreEqual("Call2", args.Parameter);
                            c++;
                        }
                    }
                }
            };

            vm.SetCanExecute("test", false);
            Assert.IsFalse(vm.CanExecute);
            Assert.Throws <NotSupportedException>(() => vm.Execute("Call1"));
            Assert.AreEqual(0, c);
            vm.SetCanExecute("test", true);
            Assert.IsTrue(vm.CanExecute);
            vm.Execute("Call2");
            Assert.AreEqual(1, c);
        }
예제 #2
0
 public ActionResult EditAction(ActionVM actionvm)
 {
     if (ModelState.IsValid)
     {
         _ObjActionRepository.UpdateAction(actionvm);
         return(RedirectToAction("ActionIndex"));
     }
     return(View(actionvm));
 }
예제 #3
0
 public ActionResult CreateAction(ActionVM actionvm)
 {
     _ObjActionRepository.InsertAction(actionvm);
     return(RedirectToAction("ActionIndex"));
 }