aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Data/Repositories/CommentRepository.cs
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-02-03 20:54:49 +0200
committertranstrike <transtrike@gmail.com>2021-02-03 20:54:49 +0200
commit5446e356a9783645f5599fb2b4f7fe8f4d05e30e (patch)
treea091c43d3c661eeff7a6cfcdb1d5200700c34b2e /src/DevHive.Data/Repositories/CommentRepository.cs
parentb045833c3c490f02b6b65ab78aa46c938117718e (diff)
downloadDevHive-5446e356a9783645f5599fb2b4f7fe8f4d05e30e.tar
DevHive-5446e356a9783645f5599fb2b4f7fe8f4d05e30e.tar.gz
DevHive-5446e356a9783645f5599fb2b4f7fe8f4d05e30e.zip
Post Editing preserves Post's comments
Diffstat (limited to 'src/DevHive.Data/Repositories/CommentRepository.cs')
-rw-r--r--src/DevHive.Data/Repositories/CommentRepository.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/DevHive.Data/Repositories/CommentRepository.cs b/src/DevHive.Data/Repositories/CommentRepository.cs
index 1560c97..382c666 100644
--- a/src/DevHive.Data/Repositories/CommentRepository.cs
+++ b/src/DevHive.Data/Repositories/CommentRepository.cs
@@ -1,4 +1,7 @@
using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
using System.Threading.Tasks;
using DevHive.Data.Interfaces.Repositories;
using DevHive.Data.Models;
@@ -31,6 +34,14 @@ namespace DevHive.Data.Repositories
.FirstOrDefaultAsync(p => p.Creator.Id == issuerId &&
p.TimeCreated == timeCreated);
}
+
+ public async Task<List<Comment>> GetPostComments(Guid postId)
+ {
+ return await this._context.Posts
+ .SelectMany(x => x.Comments)
+ .Where(x => x.Post.Id == postId)
+ .ToListAsync();
+ }
#endregion
#region Update