Example #1
0
        public ActionResult AddComment(CommentModel model)
        {
            if (ModelState.IsValid)
            {
                var comments = Session["comments"] as List<CommentModel>;
                if (comments == null)
                {
                    comments = new List<CommentModel>();
                }
                comments.Add(model);
                Session["comments"] = comments;

                return RedirectToAction("Comments");
            }
            else
                return View("CommentForm", model);
        }
Example #2
0
 public ActionResult CommentForm()
 {
     CommentModel model = new CommentModel();
     model.Author = "dslhl";
     return View(model);
 }