/// <summary> /// 根据用户ID获取用户角色 /// </summary> /// <param name="userId">用户ID</param> /// <returns>用户角色列表</returns> public BasicResponse <List <UserroleInfo> > GetUserRoleByUserId(UserroleGetByUserIdRequest userrolerequest) { BasicResponse <List <UserroleInfo> > Result = new BasicResponse <List <UserroleInfo> >(); List <UserroleModel> Userrole = _Repository.GetUserroleByUserId(userrolerequest.UserId); Result.Data = ObjectConverter.CopyList <UserroleModel, UserroleInfo>(Userrole).ToList(); return(Result); }
/// <summary> /// 根据用户编号获取所有的该用户所拥有的角色对象 /// </summary> /// <param name="userID">用户编号</param> /// <returns></returns> public BasicResponse <List <RoleInfo> > GetRoleListByUserId(UserroleGetByUserIdRequest userrolerequest) { BasicResponse <List <RoleInfo> > Result = new BasicResponse <List <RoleInfo> >(); List <UserroleModel> userroleList = _Repository.GetUserroleByUserId(userrolerequest.UserId); List <RoleModel> rolemodelList = _RoleRepository.GetRoleList(); List <RoleInfo> roleinfoList = ObjectConverter.CopyList <RoleModel, RoleInfo>(rolemodelList).ToList(); foreach (UserroleModel userrole in userroleList) { RoleInfo temprole = roleinfoList.Find(a => a.RoleID == userrole.RoleID); if (temprole != null) { Result.Data.Add(temprole); } } return(Result); }
public BasicResponse <List <RoleInfo> > GetRoleListByUserId(UserroleGetByUserIdRequest userrolerequest) { return(_userroleService.GetRoleListByUserId(userrolerequest)); }
/// <summary> /// 根据用户ID获取用户角色 /// </summary> /// <param name="userrolerequest">用户ID</param> /// <returns>用户角色列表</returns> public BasicResponse <List <UserroleInfo> > GetUserRoleByUserId(UserroleGetByUserIdRequest userrolerequest) { var responseStr = HttpClientHelper.Post(Webapi + "/v1/Userrole/GetUserRoleByUserId?token=" + Token, JSONHelper.ToJSONString(userrolerequest)); return(JSONHelper.ParseJSONString <BasicResponse <List <UserroleInfo> > >(responseStr)); }