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

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                v1.ID            = 87;
                v1.OrderID       = AddOrder();
                v1.ContractPopID = AddContractPop();
                v1.OrderQty      = 15;
                v1.RecQty        = 1;
                v2.OrderID       = v1.OrderID;
                v2.ContractPopID = v1.ContractPopID;
                v2.OrderQty      = 65;
                v2.RecQty        = 73;
                context.Set <order_pop>().Add(v1);
                context.Set <order_pop>().Add(v2);
                context.SaveChanges();
            }

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

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

            order_popBatchVM vm = rv.Model as order_popBatchVM;

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