diff options
Diffstat (limited to 'src/DevHive.Data/Repositories/RoleRepository.cs')
| -rw-r--r-- | src/DevHive.Data/Repositories/RoleRepository.cs | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/src/DevHive.Data/Repositories/RoleRepository.cs b/src/DevHive.Data/Repositories/RoleRepository.cs index 25549bf..156792d 100644 --- a/src/DevHive.Data/Repositories/RoleRepository.cs +++ b/src/DevHive.Data/Repositories/RoleRepository.cs @@ -6,32 +6,17 @@ using Microsoft.EntityFrameworkCore; namespace DevHive.Data.Repositories { - public class RoleRepository : BaseRepository, IRoleRepository + public class RoleRepository : BaseRepository<Role>, IRoleRepository { private readonly DevHiveContext _context; public RoleRepository(DevHiveContext context) + :base(context) { this._context = context; } - #region Create - public async Task<bool> AddAsync(Role entity) - { - await this._context.Roles - .AddAsync(entity); - - return await this.SaveChangesAsync(this._context); - } - #endregion - #region Read - public async Task<Role> GetByIdAsync(Guid id) - { - return await this._context.Roles - .FindAsync(id); - } - public async Task<Role> GetByNameAsync(string name) { return await this._context.Roles @@ -39,30 +24,6 @@ namespace DevHive.Data.Repositories } #endregion - #region Update - public async Task<bool> EditAsync(Role newEntity) - { - Role role = await this.GetByIdAsync(newEntity.Id); - - this._context - .Entry(role) - .CurrentValues - .SetValues(newEntity); - - return await this.SaveChangesAsync(this._context); - } - #endregion - - #region Delete - public async Task<bool> DeleteAsync(Role entity) - { - this._context.Roles - .Remove(entity); - - return await this.SaveChangesAsync(this._context); - } - #endregion - #region Validations public async Task<bool> DoesNameExist(string name) { |
