예제 #1
0
        public ActionResult Guest(Comment comment)
        {
            CommentsManager commentsManager = new CommentsManager();

            ViewBag.Comments = commentsManager.GetData();

            //add new comment
            if (Request.HttpMethod == "POST")
            {
                if (ModelState.IsValid)
                {
                    comment.CommentDate = DateTime.Now;
                    commentsManager.AddItem(comment);
                    ViewBag.Comments = commentsManager.GetData();
                    return(View());
                }
                else
                {
                    return(View());
                }
            }
            return(View());
        }