public IHttpActionResult DeleteRole(DeleteRoleInput input) { Init(); input.AccessToken = ApiSession.AccessToken; DeleteRoleOutput output = _rolesSvc.DeleteRole(input); return(Ok(output)); }
public ResponseInfoModel Delete([FromBody] DeleteRoleInput input) { ResponseInfoModel json = new ResponseInfoModel() { Success = 1, Result = new object() }; try { int[] idInts = ConvertStringToIntArr(input.ids); if (_userRoleService.GetList(a => idInts.Contains(a.RoleID)).Any()) { throw new UserFriendlyException("角色下有用户不可删除"); } if (!_roleService.Delete(a => idInts.Contains(a.ID))) { json.Success = 0; json.Result = LocalizationConst.DeleteFail; } else { foreach (var id in idInts) { _logService.Insert(new Log() { ActionContent = LocalizationConst.Delete, SourceType = _moduleName, SourceID = id, LogUserID = input.userID, LogTime = DateTime.Now, LogIPAddress = IPHelper.GetIPAddress, }); } } } catch (Exception e) { DisposeUserFriendlyException(e, ref json, "api/role/delete", LocalizationConst.DeleteFail); } return(json); }
public DeleteRoleOutput DeleteRole(DeleteRoleInput input) { try { RestHTTP http = new RestHTTP(); RestRequest req = new RestRequest("api/roles/delete", RestSharp.Method.DELETE); req.AddHeader("Content-Type", "application/json"); req.AddHeader("Authorization", "Bearer " + input.AccessToken); req.AddJsonBody(input); DeleteRoleOutput response = http.HttpPost <DeleteRoleOutput>(req); return(response); } catch (Exception ex) { WriteLogFile.Append("DeleteRole : "); WriteLogFile.Append(ex.Message); WriteLogFile.Append(ex.StackTrace); } return(null); }
public async Task <DeleteRoleOutput> DeleteRole(DeleteRoleInput input) { _roleManager.DeleteRole(input.Id); return(new DeleteRoleOutput()); }
public DeleteRoleOutput DeleteRole(DeleteRoleInput input) { _roleService.DeleteRole(input.RoleId); return(new DeleteRoleOutput()); }