public async Task <IActionResult> DeleteAsync(string[] id) { _iSysRoleService.Delete(a => id.Contains(a.Id)); var result = await _unitOfWork.CommitAsync(); return(new DeleteSuccessResult(result)); }
public IActionResult Delete(string ids) { var idsList = ids.ToList <string>(); _sysRoleService.Delete(r => idsList.Contains(r.ObjectID)); _unitOfWork.SaveChanges(); return(Json(new ResponseResult(true, "删除成功!"))); }
public IActionResult Delete(string id) { if (string.IsNullOrEmpty(id)) { return(toResponse(StatusCodeType.Error, "删除角色 Id 不能为空")); } var response = _roleService.Delete(id); return(toResponse(response)); }
public async Task <ActionResult> Delete(string id) { var item = _iSysRoleService.GetById(id); if (item.SysDefault) { throw new Exception("系统默认角色不可删除!"); } _iSysRoleService.Delete(item); await _unitOfWork.CommitAsync(); return(new DeleteSuccessResult()); }
public async Task <IActionResult> DeleteById(string id) { var res = await _sysRoleService.Delete(id); if (res) { messageModel.response = true; } else { messageModel.response = false; messageModel.msg = "删除失败"; } return(new JsonResult(messageModel)); }
public ActionResult RoleDelete(int[] ids) { try { if (_sysRoleService.Delete(m => ids.Contains(m.Id)) > 0) { LogWarning("删除内容:" + string.Join(",", ids)); return(JsonSuccess("")); } } catch { return(JsonError("对不起,角色正在使用,要想删除角色,请先把管理是此角色的用户更改成其它角色!")); } return(JsonError("对不起,操作失败!")); }
public JsonResult Delete(int id = 0) { try { var entity = _SysRoleService.GetById(id); if (entity == null) { return(Json(new { Status = Successed.Empty }, JsonRequestBehavior.AllowGet)); } _SysRoleService.Delete(entity); return(Json(new { Status = Successed.Ok }, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new { Status = Successed.Error }, JsonRequestBehavior.AllowGet)); } }
public IActionResult Delete(string id) { if (string.IsNullOrEmpty(id)) { return(toResponse(StatusCodeType.Error, "删除角色 Id 不能为空")); } if (_rolePowerService.Any(m => m.RoleUID == id)) { return(toResponse(StatusCodeType.Error, "请先删除角色关联的权限")); } if (_userRoleService.Any(m => m.RoleID == id)) { return(toResponse(StatusCodeType.Error, "请先删除角色关联的用户")); } var response = _roleService.Delete(id); return(toResponse(response)); }
public async Task <ExecuteResult> Delete(long id) { return(await _sysRoleService.Delete(new SysRoleViewModel { Id = id })); }
public async Task <ApiResult <string> > Delete([FromBody] List <long> ids) => await _sysRoleService.Delete(ids);
public bool RoleRemove([FromBody] long[] roleIds) { return(_sysRoleService.Delete(roleIds)); }
public ActionResult Delete(Guid id) { _sysRoleService.Delete(id); _unitOfWork.Commit(); return(RedirectToAction("Index")); }