public void EditForumThread() { IForumThreadDto forumThreadDto = DataHandlerFactory.DataHandlerFactory.GetForumThreadDto(); forumThreadDto.ThreadID = ThreadID; forumThreadDto.ThreadMessage = ThreadMessage; db.EditThread(forumThreadDto); }
public void EditThread(IForumThreadDto forumThreadDto) { string command = "UPDATE thread SET ThreadMessage='{0}' WHERE ThreadID={1};"; using (MySqlConnection conn = Connection.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand(string.Format(command, forumThreadDto.ThreadMessage, forumThreadDto.ThreadID), conn); cmd.ExecuteNonQuery(); } }
public IForumThread GetForumThread(int threadID) { IForumThreadDto forumThreadDto = db.GetForumThread(threadID); IForumThread forumThread = new ForumThread(DataHandlerFactory.DataHandlerFactory.GetForumThreadContext()) { AccountID = forumThreadDto.AccountID, ForumCategoryID = forumThreadDto.ForumCategoryID, ThreadDateCreated = forumThreadDto.ThreadDateCreated, ThreadID = forumThreadDto.ThreadID, ThreadMessage = forumThreadDto.ThreadMessage, ThreadTitle = forumThreadDto.ThreadTitle, }; return(forumThread); }
public int CreateThread(IForumThreadDto forumThreadDto) { string command = "INSERT INTO `thread` (`AccountID`, `ForumCategoryID`, `ThreadTitle`, `ThreadMessage`, `ThreadDateCreated`) VALUES ({0}, '{1}', '{2}', '{3}', '{4}');"; using (MySqlConnection conn = Connection.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand(string.Format(command, forumThreadDto.AccountID, forumThreadDto.ForumCategoryID, forumThreadDto.ThreadTitle, forumThreadDto.ThreadMessage, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")), conn); int rowcount = cmd.ExecuteNonQuery(); return(rowcount); } }