public async Task <IViewComponentResult> InvokeAsync(string postId) { var getComments = await _process.GetComments(postId); var model = new List <CommentsViewModel>(); foreach (var comment in getComments) { var history = await _process.GetCommentHistory(comment.Id.ToString()); model.Add(new CommentsViewModel() { Id = comment.Id, PostId = postId, Author = comment.Author, Message = comment.Message, CommentDateTime = comment.CommentDateTime, CommentHistory = history }); } return(View(model)); }