예제 #1
0
        public ActionResult _Header()
        {
            IList <board_Tb> objItem         = Service_Board_P.ListBoard_Md().OrderBy(m => m.id).ToList();
            HomeViewModel    HomeViewModel_P = new HomeViewModel();

            HomeViewModel_P.boardList = objItem;
            string account = Convert.ToString(Session[InternalVal._SESSIONACCOUNT] ?? "").Trim();

            ViewData["onLogin"] = false;    //預設未登入
            //是否已登入
            if (!string.IsNullOrEmpty(account))
            {
                ViewData["onLogin"]  = true;
                ViewData["username"] = Convert.ToString(Session[InternalVal._SESSIONNAME].ToString());
            }
            return(PartialView(HomeViewModel_P));
        }
예제 #2
0
        public ActionResult LaunchArticle(int?board, int?theme)
        {
            HomeViewModel viewModel = new HomeViewModel();

            viewModel.boardList = new List <board_Tb>();
            board_Tb        boardItem  = new board_Tb();
            List <board_Tb> themeItems = new List <board_Tb>();

            //討論版ID如為空
            Method.ValueIsEmpty(board);
            if (Method.ValueIsEmpty_Val)
            {
                //獲取全部討論版,在選取後由AJAX取得分類(LaunchArticleTheme)
                viewModel.boardList = Service_Board_P.ListBoard_Md().OrderBy(m => m.id).ToList();
            }
            else
            {
                //當前討論版資訊
                Method.ValueIsEmpty(theme);
                if (!Method.ValueIsEmpty_Val)
                {
                    boardItem.id = (int)theme;
                }
                boardItem.theme_board_id = (int)board;
                boardItem.board_name     = Service_Board_P.GetBoardName_Md((int)board);
                //獲取討論版分類
                themeItems = Service_Board_P.ListTheme_Md((int)board);
                //無討論版分類

                //themeItems = Service_Board_P.ListTheme_Md((int)board);
            }
            viewModel.themeList   = themeItems;
            viewModel.boardItem   = boardItem;
            viewModel.articleItem = new article_Tb();
            Session["ViewModel"]  = viewModel;

            return(View(viewModel));
        }