Ejemplo n.º 1
0
        public ActionResult Index()
        {
            //判断当前是否为一个登录的状态
            sessionModel = UserState.GetCurrentUser(SessionId.GetSessionId());
            if (sessionModel != null && sessionModel.User != null)
            {
                ViewBag.User    = UserService.GetViewUser(sessionModel.User);
                ViewBag.logined = true;
            }
            else
            {
                ViewBag.logined = false;
            }
            ViewHomeIndex homeIndex = new ViewHomeIndex();

            homeIndex.Boards = BoardService.GetBoards();
            //现在要做的就是获取前5个帖子
            homeIndex.Posts       = PostService.GetViewPostTop();
            homeIndex.PostsRandom = PostService.GetViewPostRandom();
            return(View(homeIndex));
        }