public ActionResult EditArticle(int article, int board, int theme) { HomeViewModel viewModel = new HomeViewModel(); board_Tb boardItem = new board_Tb(); article_Tb articleItem = new article_Tb(); List <board_Tb> themeItems = new List <board_Tb>(); articleItem = Service_Article_P.GetArticle_Md(article); boardItem = Service_Board_P.BoardItem_Md(null, theme); boardItem.id = theme; boardItem.theme_board_id = board; boardItem.board_name = Service_Board_P.GetBoardName_Md(board); themeItems = Service_Board_P.ListTheme_Md(board); viewModel.articleItem = articleItem; viewModel.boardItem = boardItem; viewModel.themeList = themeItems; return(View(viewModel)); }
public ActionResult ReplyArticle(int?article, int?board, int?theme, int?reply) { //判斷是否有文章編號 Method.ValueIsEmpty(article); if (Method.ValueIsEmpty_Val) { return(RedirectToAction("Index", "Home")); } HomeViewModel viewModel = new HomeViewModel(); article_Tb articleItem = new article_Tb(); article_reply_Tb replyItem = new article_reply_Tb(); int num = (int)article; articleItem = Service_Article_P.GetArticle_Md(num); articleItem.title = Method.StrSubstring(articleItem.title, 0, 50); board_Tb boardItem = new board_Tb(); boardItem = Service_Board_P.BoardItem_Md(null, theme); viewModel.replyCount = Service_Article_P.GetArticleReplyCount_Md((int)article); //回覆樓主 TempData["replyAuthor"] = true; if (boardItem.theme_board_id != board && boardItem.id != theme) { TempData[InternalVal._RESULTMSG] = "發生錯誤!無法回覆文章!"; return(RedirectToAction("ResultMessage", "Home")); } if (reply != null) { replyItem = Service_Article_P.GetArticleReply_Md(reply); articleItem.arti_txt = "\"引用:" + Method.StrSubstring(replyItem.reply_txt, 0, 30) + "\""; TempData["replyAuthor"] = false; } boardItem.theme_board_id = articleItem.board_id; boardItem.id = (int)theme; boardItem.board_name = Service_Board_P.GetBoardName_Md((int)board); boardItem.theme_name = boardItem.theme_name; viewModel.articleItem = articleItem; viewModel.boardItem = boardItem; return(View(viewModel)); }