Exemple #1
0
        public OnlineUserDto GetUserInfo(string username)
        {
            var info = (from u in _dal.Find()
                        join ur in _userRoleServices.Find() on u.Id equals ur.UserId
                        where u.LoginName == username
                        select new OnlineUserDto
            {
                Id = u.Id.ToString(),
                Email = u.Email,
                HeadImg = u.HeadImg,
                NickName = u.RealName,
                UserName = u.LoginName,
                Roles = (from ur in _userRoleServices.Find()
                         join r in _roleServices.Find() on ur.RoleId equals r.Id
                         where ur.UserId == u.Id
                         select r.Name).ToArray()
            }).FirstOrDefault();

            return(info);
        }