コード例 #1
0
        public ActionResult Comment(Comment comment, string login, int postId)
        {
            User currentUser = _userRepository.GetUserByNickname(User.Identity.Name);

            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Page", new { login }));
            }

            comment.TimeCommented = DateTime.Now;
            comment.CommentOwner  = currentUser;

            _postManager.CommentPost(comment, postId, login);

            return(RedirectToAction("Page", new { login }));
        }