/// <summary> /// 遍历我的收藏过的帖子 /// Creator:Simple /// </summary> /// <returns></returns> public ActionResult myCollections() { if (Session["userName"] == null) { return(RedirectToAction("LoginRemind", "Topic")); } LoginStatusConfig();//配置登录状态 string userName = Session["userName"].ToString(); ////获取用户等级名 Rank_bll rank_bll = new Rank_bll(); string rankNameDB = rank_bll.GetRankName(userName); //该用户数据库里的等级名 rankNameDB = rankNameDB.Trim(); //去除空格 User_bll user_bll = new User_bll(); int userId = Convert.ToInt32(user_bll.GetUserId(userName)); //通过用户名获取userId CountUser_model countUser_model = user_bll.GetCountUser(userId, rankNameDB); //获取用户的CountUser_model 数据:点赞数 关注数 粉丝数 收藏数 提问数 回帖数 特定咨询数 等 ViewData["countUser_model"] = countUser_model; ViewData["rankName"] = rankNameDB; ViewData["actionName"] = "myCollections";//当前action名 Collect_bll collect_bll = new Collect_bll(); List <Collect_model> collect_modelList = new List <Collect_model>(); collect_modelList = collect_bll.GetShortCollectPostData(userId);//通过userId获取用户的收藏过的帖子 return(View(collect_modelList)); }
public ActionResult myCollections() { if (Session["userName"] == null) { return(RedirectToAction("LoginRemind", "Topic")); } LoginStatusConfig();//配置登录状态 string userName = Session["userName"].ToString(); User_bll user_bll = new User_bll(); int userId = Convert.ToInt32(user_bll.GetUserId(userName)); //通过用户名获取userId CountUser_model countUser_model = user_bll.GetCountUser(userId); //获取用户的CountUser_model 数据:点赞数 关注数 粉丝数 收藏数 提问数 回帖数 特定咨询数 等 ViewData["countUser_model"] = countUser_model; Collect_bll collect_bll = new Collect_bll(); List <Collect_model> collect_modelList = new List <Collect_model>(); collect_modelList = collect_bll.GetShortCollectPostData(userId);//通过userId获取用户的收藏过的帖子 return(View(collect_modelList)); }