public UserInformation Auths() { LinUser linUser = _freeSql.Select <LinUser>().Where(r => r.Id == _currentUser.Id).First(); UserInformation user = _mapper.Map <UserInformation>(linUser); user.Avatar = _currentUser.GetFileUrl(linUser.Avatar); user.GroupName = user.GroupId != null?_freeSql.Select <LinGroup>().Where(r => r.Id == user.GroupId).First()?.Info : ""; if (linUser.IsAdmin()) { user.Auths = new List <IDictionary <string, object> >(); } else { if (linUser.GroupId != 0) { List <LinAuth> listAuths = _freeSql.Select <LinAuth>().Where(r => r.GroupId == linUser.GroupId).ToList(); user.Auths = ReflexHelper.AuthsConvertToTree(listAuths);; } } return(user); }
public GroupDto Get(int id) { LinGroup group = _freeSql.Select <LinGroup>().Where(r => r.Id == id).First(); GroupDto groupDto = _mapper.Map <GroupDto>(group); List <LinAuth> listAuths = _freeSql.Select <LinAuth>().Where(r => r.GroupId == id).ToList(); groupDto.Auths = ReflexHelper.AuthsConvertToTree(listAuths); return(groupDto); }