aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Data/Repositories/PostRepository.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DevHive.Data/Repositories/PostRepository.cs')
-rw-r--r--src/DevHive.Data/Repositories/PostRepository.cs54
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
}
}