From 5a6c50b90ef700dd4b4b00fee76466d0bf9a7a1e Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 7 Sep 2018 10:01:32 +0300 Subject: [PATCH] Blog module comment and reply orders --- .../Volo/Blogging/Comments/CommentAppService.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Comments/CommentAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Comments/CommentAppService.cs index 0fe0666820..531666bfa9 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Comments/CommentAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Comments/CommentAppService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Services; @@ -39,6 +40,13 @@ namespace Volo.Blogging.Comments } } + hierarchicalComments = hierarchicalComments.OrderByDescending(c => c.Comment.CreationTime).ToList(); + + foreach (var hierarchicalComment in hierarchicalComments) + { + hierarchicalComment.Replies = hierarchicalComment.Replies.OrderBy(c => c.CreationTime).ToList(); + } + return hierarchicalComments; }