예제 #1
0
        public void BatchDeleteTest()
        {
            VOS_Customer v1 = new VOS_Customer();
            VOS_Customer v2 = new VOS_Customer();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                v1.cust_no   = "2gSheVYN";
                v1.cust_name = "NJZae6UEQ";
                v2.cust_no   = "J3x8";
                v2.cust_name = "TvA";
                context.Set <VOS_Customer>().Add(v1);
                context.Set <VOS_Customer>().Add(v2);
                context.SaveChanges();
            }

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

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

            VOS_CustomerBatchVM vm = rv.Model as VOS_CustomerBatchVM;

            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 <VOS_Customer>().Count(), 2);
            }
        }
예제 #2
0
 public ActionResult DoBatchDelete(VOS_CustomerBatchVM vm, IFormCollection nouse)
 {
     if (!ModelState.IsValid || !vm.DoBatchDelete())
     {
         return(PartialView("BatchDelete", vm));
     }
     else
     {
         return(FFResult().CloseDialog().RefreshGrid().Alert(WalkingTec.Mvvm.Core.Program._localizer?["OprationSuccess"]));
     }
 }