public ActionResult LoadUserInfo(long userId) { if (userId == 0) { return(View()); } var user = UserService.GetUserById(userId); if (user == null) { return(View()); } return(Json(new AjaxResult { Status = "OK", Data = new UserInfo { Id = user.Id, Biography = user.Biography, FollowerCount = FollowService.GetFollowerCount(userId), FollowingCount = FollowService.GetFollowingCount(userId), FullName = user.FullName, PostCount = PostService.GetPostCount(userId), ProfilePic = user.ProfilePic, UserName = user.UserName, IsFollowing = FollowService.IsFollowing(Convert.ToInt64(Session["userId"]), userId) } })); }
public ActionResult Index(long?id) { //IUserService UserService1 = new Service.UserService(); if (id == null) { return(View()); } ViewBag.FollowerCount = FollowService.GetFollowerCount(id.Value); ViewBag.FollowingCount = FollowService.GetFollowingCount(id.Value); if (Convert.ToInt64(Session["userId"]) != id.Value) { ViewBag.Following = FollowService.IsFollowing(Convert.ToInt64(Session["userId"]), id.Value); } ViewBag.PostCount = PostService.GetPostCount(id.Value); ViewBag.PostList = PostService.GetPostPagerList(id.Value, PageSize, 1).Select( p => new PostInfo(p)); return(View(UserService.GetUserById(id.Value))); }