public async Task <IActionResult> PostComment(int id, [Bind("Text")] Comment comment, string parentCommentId) { id = (int)TempData["postId"]; var post = await _postService.GetPostById((int)id); if (post == null) { return(NotFound()); } if (ModelState.IsValid) { var author = await _accountService.GetCurrentUser(User); int parentId; Int32.TryParse(parentCommentId, out parentId); await _postService.AddPostComment(post.PostId, author, comment, parentId); return(RedirectToAction( nameof(Details), new RouteValueDictionary(new { controller = "Post", action = "Details", id = post.PostId } ))); } return(View(post)); }