public void BatchDeleteTest() { ship_pop_sum v1 = new ship_pop_sum(); ship_pop_sum v2 = new ship_pop_sum(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v1.OrderRemark = "6od"; v2.OrderRemark = "xq2r"; context.Set <ship_pop_sum>().Add(v1); context.Set <ship_pop_sum>().Add(v2); context.SaveChanges(); } PartialViewResult rv = (PartialViewResult)_controller.BatchDelete(new string[] { v1.ID.ToString(), v2.ID.ToString() }); Assert.IsInstanceOfType(rv.Model, typeof(ship_pop_sumBatchVM)); ship_pop_sumBatchVM vm = rv.Model as ship_pop_sumBatchVM; 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 <ship_pop_sum>().Count(), 0); } }
public ActionResult DoBatchDelete(ship_pop_sumBatchVM vm, IFormCollection nouse) { if (!ModelState.IsValid || !vm.DoBatchDelete()) { return(PartialView("BatchDelete", vm)); } else { return(FFResult().CloseDialog().RefreshGrid().Alert(WalkingTec.Mvvm.Core.Program._localizer?["OprationSuccess"])); } }