Exemplo n.º 1
0
        public IActionResult AddCommentToArticle(DetailsArticleViewModel model)
        {
            var commentText = model.CurrentCommentContent;
            var articleId   = model.Id;

            var          userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            FirstAppUser user   = UserManager.FindByIdAsync(userId).Result;

            CommentService.AddCommentToArticle(user, commentText, articleId);

            return(RedirectToAction("DetailsArticle", "Articles", "2"));
        }
Exemplo n.º 2
0
        public IActionResult AddComment(DetailsArticleViewModel model)
        {
            var user      = UserManager.FindByNameAsync(User.Identity.Name).Result;
            var articleId = model.Id;

            var commentText = model.CurrentCommentContent;


            CommentService.AddCommentToArticle(user, commentText, articleId);

            return(RedirectToAction(nameof(DetailsArticle), new { id = articleId }));
        }