public IActionResult AddComment(Comments c)
        {
            BlogDB db = new BlogDB(_connectionString);

            db.AddComment(c);
            Response.Cookies.Append("name", c.CommenterName);
            return(Redirect($"/Home/ViewBlog?id={c.BlogPostId}"));
        }
Esempio n. 2
0
        public IActionResult AddComment(BlogComment c)
        {
            Response.Cookies.Append("authorCookie", $"{c.CommentAuthor}");//sets/updates the cookie

            BlogDB db = new BlogDB(_conn);

            db.AddComment(c);
            return(Redirect($"/Home/IndexPost?blogId={ c.BlogId}"));
        }