public ActionResult DeleteMultiple(BulkActionViewModel input) { if (input.EntityIds != null && input.EntityIds.Any()) { input.EntityIds.ForEachItem(x => { var permission = _permissionsService.GetPermission(x); _authorizationRepository.RemovePermission(permission); }); _repository.Commit(); } var notification = new Notification { Success = true, Message = CoreLocalizationKeys.SUCCESSFUL_SAVE.ToString() }; return Json(notification,JsonRequestBehavior.AllowGet); }
public JsonResult DeleteMultiple(BulkActionViewModel input) { input.EntityIds.ForEachItem(x => { var userLoginInfo = _repository.Find<UserLoginInfo>(x); if (userLoginInfo != null) { User deleteMe=null; if (userLoginInfo.User.UserLoginInfos.Count() == 1) { deleteMe = userLoginInfo.User; } _authorizationRepository.DetachUserFromAllGroups(userLoginInfo); _repository.Delete(userLoginInfo); if(deleteMe!=null) { _repository.Delete(deleteMe); } } }); _repository.Commit(); return Json(new Notification { Success = true }, JsonRequestBehavior.AllowGet); }