Ejemplo n.º 1
0
        public void BatchDeleteTest()
        {
            VOS_Plan v1 = new VOS_Plan();
            VOS_Plan v2 = new VOS_Plan();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                v1.Plan_no    = "5gKbDD";
                v1.ShopnameId = AddShopname();
                v1.PlanFee    = "QDD";
                v2.Plan_no    = "Hvyf";
                v2.ShopnameId = v1.ShopnameId;
                v2.PlanFee    = "4cskm";
                context.Set <VOS_Plan>().Add(v1);
                context.Set <VOS_Plan>().Add(v2);
                context.SaveChanges();
            }

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

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

            VOS_PlanBatchVM vm = rv.Model as VOS_PlanBatchVM;

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