diff options
| author | transtrike <transtrike@gmail.com> | 2021-01-23 22:34:43 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-01-23 22:34:43 +0200 |
| commit | e01a81954e0fba2c4521e03a76f48a970a87994f (patch) | |
| tree | d2fdacbed68de0f4f32b1d949d75bc1de9f861d3 /src/DevHive.Data/Repositories/PostRepository.cs | |
| parent | fac1bf2d1772e60cbecc1cf0381c6063a0e97ffd (diff) | |
| download | DevHive-e01a81954e0fba2c4521e03a76f48a970a87994f.tar DevHive-e01a81954e0fba2c4521e03a76f48a970a87994f.tar.gz DevHive-e01a81954e0fba2c4521e03a76f48a970a87994f.zip | |
All Post&Comment Implemented; Initializing testing...
Diffstat (limited to 'src/DevHive.Data/Repositories/PostRepository.cs')
| -rw-r--r-- | src/DevHive.Data/Repositories/PostRepository.cs | 54 |
1 files changed, 2 insertions, 52 deletions
diff --git a/src/DevHive.Data/Repositories/PostRepository.cs b/src/DevHive.Data/Repositories/PostRepository.cs index 9230a2e..a79eacf 100644 --- a/src/DevHive.Data/Repositories/PostRepository.cs +++ b/src/DevHive.Data/Repositories/PostRepository.cs @@ -16,56 +16,13 @@ namespace DevHive.Data.Repositories this._context = context; } - #region Create - public async Task<bool> AddCommentAsync(Comment entity) - { - await this._context.Comments - .AddAsync(entity); - - return await this.SaveChangesAsync(this._context); - } - #endregion - #region Read - public async Task<Post> GetPostByIssuerAndTimeCreatedAsync(Guid issuerId, DateTime timeCreated) + public async Task<Post> GetPostByCreatorAndTimeCreatedAsync(Guid creatorId, DateTime timeCreated) { return await this._context.Posts - .FirstOrDefaultAsync(p => p.IssuerId == issuerId && + .FirstOrDefaultAsync(p => p.CreatorId == creatorId && p.TimeCreated == timeCreated); } - - public async Task<Comment> GetCommentByIdAsync(Guid id) - { - return await this._context.Comments - .FindAsync(id); - } - - public async Task<Comment> GetCommentByIssuerAndTimeCreatedAsync(Guid issuerId, DateTime timeCreated) - { - return await this._context.Comments - .FirstOrDefaultAsync(p => p.IssuerId == issuerId && - p.TimeCreated == timeCreated); - } - #endregion - - #region Update - public async Task<bool> EditCommentAsync(Comment newEntity) - { - this._context.Comments - .Update(newEntity); - - return await this.SaveChangesAsync(this._context); - } - #endregion - - #region Delete - public async Task<bool> DeleteCommentAsync(Comment entity) - { - this._context.Comments - .Remove(entity); - - return await this.SaveChangesAsync(this._context); - } #endregion #region Validations @@ -75,13 +32,6 @@ namespace DevHive.Data.Repositories .AsNoTracking() .AnyAsync(r => r.Id == postId); } - - public async Task<bool> DoesCommentExist(Guid id) - { - return await this._context.Comments - .AsNoTracking() - .AnyAsync(r => r.Id == id); - } #endregion } } |
