public async Task <JsonResult> GetCreate() { //返回数据 var userSexTypes = EnumHelper.EnumToList <GlobalEnumVars.UserSexTypes>(); var roles = await _sysRoleServices.QueryListByClauseAsync(p => p.deleted == false); var jm = new AdminUiCallBack { code = 0 }; jm.data = new { userSexTypes, roles }; return(new JsonResult(jm)); }
public async Task <JsonResult> GetEditUserInfo() { var jm = new AdminUiCallBack(); var userModel = await _sysUserServices.QueryByIdAsync(_user.ID); if (userModel != null) { var roles = await _sysUserRoleServices.QueryListByClauseAsync(p => p.userId == userModel.id); if (roles.Any()) { var roleIds = roles.Select(p => p.roleId).ToList(); userModel.roles = await _sysRoleServices.QueryListByClauseAsync(p => roleIds.Contains(p.id)); } if (userModel.organizationId != null && userModel.organizationId > 0) { var organization = await _sysOrganizationServices.QueryByIdAsync(userModel.organizationId); if (organization != null) { userModel.organizationName = organization.organizationName; } } } jm.code = 0; jm.msg = "数据获取正常"; jm.data = userModel; return(new JsonResult(jm)); }