Exemple #1
0
        public void BatchDeleteTest()
        {
            area v1 = new area();
            area v2 = new area();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                context.Set <area>().Add(v1);
                context.Set <area>().Add(v2);
                context.SaveChanges();
            }

            PartialViewResult rv = (PartialViewResult)_controller.BatchDelete(new string[] { v1.ID.ToString(), v2.ID.ToString() });

            Assert.IsInstanceOfType(rv.Model, typeof(areaBatchVM));

            areaBatchVM vm = rv.Model as areaBatchVM;

            vm.Ids = new string[] { v1.ID.ToString(), v2.ID.ToString() };
            _controller.DoBatchDelete(vm, null);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                Assert.AreEqual(context.Set <area>().Count(), 0);
            }
        }
Exemple #2
0
 public ActionResult DoBatchDelete(areaBatchVM vm, IFormCollection nouse)
 {
     if (!ModelState.IsValid || !vm.DoBatchDelete())
     {
         return(PartialView("BatchDelete", vm));
     }
     else
     {
         return(FFResult().CloseDialog().RefreshGrid().Alert(WalkingTec.Mvvm.Core.Program._localizer?["OprationSuccess"]));
     }
 }