Esempio n. 1
0
        public IActionResult AddComment(Comment comment, int blogId)
        {
            BlogDb db = new BlogDb();

            db.AddComment(comment, blogId);
            Response.Cookies.Append("commenterName", $"{comment.CommentAuthor}");
            return(Redirect($"/home/displaypost?blogid={blogId}"));
        }
Esempio n. 2
0
        public ActionResult AddComment(Comment comment)
        {
            BlogDb db = new BlogDb(Properties.Settings.Default.ConStr);

            comment.DateCreated = DateTime.Now;
            db.AddComment(comment);
            return(Redirect($"/home/viewblog?id={comment.PostId}"));
        }
Esempio n. 3
0
        public ActionResult AddComment(Comment comment)
        {
            BlogDb db = new BlogDb(Properties.Settings.Default.ConStr);

            comment.DateCreated = DateTime.Now;
            db.AddComment(comment);
            Response.Cookies.Add(new HttpCookie("commenter-name", comment.Name));
            return(Redirect($"/home/viewblog?id={comment.PostId}"));
        }
Esempio n. 4
0
        public ActionResult AddComment(Comment comment)
        {
            var db = new BlogDb(_connectionString);

            comment.DateCreated = DateTime.Now;
            db.AddComment(comment);
            Response.Cookies.Append("commenter-name", comment.Name);
            return(Redirect($"/home/viewblog?id={comment.PostId}"));
        }
Esempio n. 5
0
        public ActionResult Comment(string name, string text, int postId)
        {
            var     db      = new BlogDb(_connectionString);
            Comment comment = new Comment
            {
                Date   = DateTime.Now,
                Name   = name,
                Text   = text,
                PostId = postId
            };

            db.AddComment(comment);
            return(RedirectToAction("Post", new { postId = postId }));
        }