diff --git a/ImageBoardServerApp/Data/Repository/CommentsRepository.cs b/ImageBoardServerApp/Data/Repository/CommentsRepository.cs index c86a853..83d3384 100644 --- a/ImageBoardServerApp/Data/Repository/CommentsRepository.cs +++ b/ImageBoardServerApp/Data/Repository/CommentsRepository.cs @@ -26,6 +26,8 @@ public static class CommentsRepository .Where(comment => comment.CommentID == postId) .Include(comment => comment.Image) .Include(comment => comment.Post) + .Include(comment => comment.User) + .Include(comment => comment.Report) .FirstOrDefaultAsync(); } @@ -63,6 +65,8 @@ public static class CommentsRepository { await using var db = new AppDBContext(); CommentData commentToDelete = await getCommentByIdAsync(postId); + if (commentToDelete.Report != null) + db.Remove(commentToDelete.Report); db.Remove(commentToDelete); return await db.SaveChangesAsync() >= 1; }