Beispiel #1
0
        public async Task <IActionResult> AddComment(CommentAddDto commentAddDto)
        {
            var result = await _articleService.Get(commentAddDto.ArticleId);

            var article = result.Data.Article;

            if (ModelState.IsValid)
            {
                var createdName = commentAddDto.FirstName + commentAddDto.LastName;
                await _commentService.Add(commentAddDto, createdName);

                return(RedirectToAction("BlogDetail", new { name = SeoHelper.ToSeoUrl(article.Title), id = article.Id }));
            }
            return(RedirectToAction("BlogDetail", new { name = SeoHelper.ToSeoUrl(article.Title), id = article.Id }));
        }