// 得到用户信息+博客主页 public User GetUserAndBlogUrl(long?userId) { User user = GetUserInfo(userId); UserBlog userBlog = BlogService.GetUserBlog(userId); BlogUrls blogUrls = BlogService.GetBlogUrls(userBlog, user); //UserAndBlogUrl userAndBlogUrl = new UserAndBlogUrl() //{ // User = user, // BlogUrl = blogUrls.IndexUrl, // PostUrl = blogUrls.PostUrl, //}; user.BlogUrl = blogUrls.IndexUrl; user.PostUrl = blogUrls.PostUrl; return(user); }
/// <summary> /// 得到userAndBlog公开信息 /// </summary> /// <param name="userId">用户ID</param> /// <returns></returns> public UserAndBlog GetUserAndBlog(long?userId) { var user = this.GetUserInfo(userId); var userBlog = BlogService.GetUserBlog(userId); var userAndBlog = new UserAndBlog() { UserId = user.UserId, Username = user.Username, Email = user.Email, Logo = user.Logo, BlogTitle = userBlog.Title, BlogLogo = userBlog.Logo, BlogUrl = BlogService.GetUserBlogUrl(userBlog, user.Username), BlogUrls = BlogService.GetBlogUrls(userBlog, user) }; return(userAndBlog); }