Example #1
0
        public ActionResult Comment(int id, string name, string email, string body)
        {
            Post    post    = GetPost(id);
            Comment comment = new Comment();

            //Point the comment at the post
            comment.Post     = post;
            comment.DateTime = DateTime.Now;
            comment.Name     = name;
            comment.Email    = email;
            comment.Body     = body;
            model.AddToComments(comment);
            model.SaveChanges();
            return(RedirectToAction("Details", new { id = id }));
        }