// 新增評論 public string insertComment(CM.CommentModel iComment) { #region [做DB連線 以及 執行DB處理] // 建立DB連線 Tools.DBConnection bsc = new Tools.DBConnection(); // 放入 commentID的資料 string doDB = bsc.ActionDB( string.Format( @"INSERT INTO [Comment] (JOB_ID,USER_ID,CONTENT_TEXT,TIME) VALUES({0},'{1}','{2}',CURRENT_TIMESTAMP);" , iComment.Job_ID, iComment.SessionID, iComment.Content_Text) ); // 如果 doDB為"success" ,代表DB連線成功 ,反之失敗 if (doDB != "success") { return("DB處理錯誤"); } return("新增評論成功!"); #endregion }
public ActionResult insertComment(CM.CommentModel commentModel) { string msg = ""; CM.Comment cm = new CM.Comment(); commentModel.SessionID = Session["suserID"].ToString(); msg = cm.insertComment(commentModel); return(Content(msg)); }