Beispiel #1
0
        public void SubmitComment(BlogPostComment m_Comment)
        {
            DBHome.SubmitComment(m_Comment);

            /*MailMessage m_Message = new MailMessage("*****@*****.**", "*****@*****.**");
            m_Message.Subject = "New Blog Post for Approval";
            m_Message.Body = @"Go approve the comment";
            SmtpClient client = new SmtpClient("localhost");
            client.UseDefaultCredentials = true;

            client.Send(m_Message);*/
        }
Beispiel #2
0
        public static void SubmitComment(BlogPostComment m_Comment)
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "INSERT INTO CMS_BlogPostComments(comment, name, blogId, pageWorkFlowState) VALUES(@comment, @name, @blogId, 2)";
            SqlCommand insertComment = new SqlCommand(queryString, conn);
            insertComment.Parameters.AddWithValue("comment", m_Comment.Comment);
            insertComment.Parameters.AddWithValue("name", m_Comment.Name);
            insertComment.Parameters.AddWithValue("blogId", m_Comment.BlogId);
            insertComment.ExecuteNonQuery();

            conn.Close();
        }
 public ActionResult SubmitComment(BlogPostComment m_Comment)
 {
     HomeRepository.SubmitComment(m_Comment);
     return RedirectToAction("BlogPost", "Home", new { id = m_Comment.Id });
 }
Beispiel #4
0
        public static List<BlogPostComment> GetComments(int BlogId)
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "SELECT * FROM CMS_BlogPostComments WHERE blogId = @blogId AND pageWorkFlowState != 4 ORDER BY id DESC";
            SqlCommand getComments = new SqlCommand(queryString, conn);
            getComments.Parameters.AddWithValue("blogId", BlogId);
            SqlDataReader commentReader = getComments.ExecuteReader();

            List<BlogPostComment> m_Comments = new List<BlogPostComment>();

            while (commentReader.Read())
            {
                BlogPostComment m_Comment = new BlogPostComment();
                m_Comment.Id = commentReader.GetInt32(0);
                m_Comment.BlogId = commentReader.GetInt32(1);
                m_Comment.Comment = commentReader.GetString(2);
                m_Comment.Name = commentReader.GetString(3);
                m_Comment.PageWorkFlowState = commentReader.GetInt32(4);

                m_Comments.Add(m_Comment);
            }

            return m_Comments;
        }