コード例 #1
0
        public IActionResult AddComment(AddCommentViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var comment = new Comments
            {
                CommentText  = model.Text,
                CommentTitle = model.Title,
                CreateDate   = DateTime.Now,
                IsShowing    = false
            };

            _service.AddComment(comment);
            return(Redirect("/"));
        }