Esempio n. 1
0
 public ActionResult PostComment(int postId, string name, string content)
 {
     var db = new BlogDb(@"Data Source=.\sqlexpress;Initial Catalog=Blog;Integrated Security=True");
     Comment comment = new Comment {PostId = postId, Content = content, Name = name, Date = DateTime.Now};
     db.AddComment(comment);
     return RedirectToAction("Post", new {pid = postId});
 }
Esempio n. 2
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});
        }