public ActionResult DoBatchDelete(PlayerSpecialBatchVM vm, IFormCollection nouse)
 {
     if (!ModelState.IsValid || !vm.DoBatchDelete())
     {
         return(PartialView("BatchDelete", vm));
     }
     else
     {
         return(FFResult().CloseDialog().RefreshGrid().Alert("操作成功,共有" + vm.Ids.Length + "条数据被删除"));
     }
 }
        public void BatchDeleteTest()
        {
            PlayerSpecial v1 = new PlayerSpecial();
            PlayerSpecial v2 = new PlayerSpecial();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                v1.Strength     = 70;
                v1.Perception   = 76;
                v1.Endurance    = 25;
                v1.Charisma     = 74;
                v1.Intelligence = 72;
                v1.Agility      = 28;
                v1.Luck         = 51;
                v2.Strength     = 88;
                v2.Perception   = 62;
                v2.Endurance    = 44;
                v2.Charisma     = 64;
                v2.Intelligence = 24;
                v2.Agility      = 89;
                v2.Luck         = 87;
                context.Set <PlayerSpecial>().Add(v1);
                context.Set <PlayerSpecial>().Add(v2);
                context.SaveChanges();
            }

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

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

            PlayerSpecialBatchVM vm = rv.Model as PlayerSpecialBatchVM;

            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 <PlayerSpecial>().Count(), 0);
            }
        }