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}")); }
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}")); }
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}")); }
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}")); }
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 })); }