public async Task <ActionResult> DoBatchDelete(FrameworkUserBatchVM vm, IFormCollection nouse) { List <string> itcode = new List <string>(); itcode = DC.Set <FrameworkUser>().CheckIDs(new List <string>(vm.Ids)).Select(x => x.ITCode).ToList(); if (!ModelState.IsValid || !vm.DoBatchDelete()) { return(PartialView("BatchDelete", vm)); } else { using (var tran = DC.BeginTransaction()) { try { var ur = DC.Set <FrameworkUserRole>().Where(x => itcode.Contains(x.UserCode)); DC.Set <FrameworkUserRole>().RemoveRange(ur); var ug = DC.Set <FrameworkUserGroup>().Where(x => itcode.Contains(x.UserCode)); DC.Set <FrameworkUserGroup>().RemoveRange(ug); DC.SaveChanges(); tran.Commit(); } catch { tran.Rollback(); } } await Wtm.RemoveUserCache(itcode.ToArray()); return(FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.OprationSuccess"])); } }
public ActionResult DoBatchDelete(FrameworkUserBatchVM vm, IFormCollection nouse) { if (!ModelState.IsValid || !vm.DoBatchDelete()) { return(PartialView("BatchDelete", vm)); } else { return(FFResult().CloseDialog().RefreshGrid().Alert("操作成功")); } }
public ActionResult BatchDelete(FrameworkUserBatchVM vm, FormCollection noUse) { if (!ModelState.IsValid || !vm.DoBatchDelete()) { return(PartialView(vm)); } else { return(FFResult().CloseDialog().RefreshGrid().Alert(Language.OperationSucc)); } }
public async Task <ActionResult> DoBatchDelete(FrameworkUserBatchVM vm, IFormCollection nouse) { if (!ModelState.IsValid || !vm.DoBatchDelete()) { return(PartialView("BatchDelete", vm)); } else { List <Guid?> tempids = new List <Guid?>(); foreach (var item in vm?.Ids) { tempids.Add(Guid.Parse(item)); } var userids = DC.Set <FrameworkUserBase>().Where(x => tempids.Contains(x.ID)).Select(x => x.ID.ToString()).ToArray(); await LoginUserInfo.RemoveUserCache(userids); return(FFResult().CloseDialog().RefreshGrid().Alert(Program._localizer?["OprationSuccess"])); } }