diff options
| author | transtrike <transtrike@gmail.com> | 2021-01-12 20:45:14 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-01-12 20:45:14 +0200 |
| commit | 56f5578d5f93a56984deb6735dba51551868f6d8 (patch) | |
| tree | 5f309ba5a79882ad41ed78bf7ae8f18f38be757e /src/DevHive.Data/Repositories | |
| parent | d2a754aa220f37ac28393451e7ad5793687bb999 (diff) | |
| download | DevHive-56f5578d5f93a56984deb6735dba51551868f6d8.tar DevHive-56f5578d5f93a56984deb6735dba51551868f6d8.tar.gz DevHive-56f5578d5f93a56984deb6735dba51551868f6d8.zip | |
Full implementation of Language & Technologies to User
Diffstat (limited to 'src/DevHive.Data/Repositories')
| -rw-r--r-- | src/DevHive.Data/Repositories/TechnologyRepository.cs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/DevHive.Data/Repositories/TechnologyRepository.cs b/src/DevHive.Data/Repositories/TechnologyRepository.cs index cc0e642..21d69a3 100644 --- a/src/DevHive.Data/Repositories/TechnologyRepository.cs +++ b/src/DevHive.Data/Repositories/TechnologyRepository.cs @@ -7,7 +7,7 @@ using Microsoft.EntityFrameworkCore; namespace DevHive.Data.Repositories { - public abstract class TechnologyRepository : IRepository<Technology> + public class TechnologyRepository : IRepository<Technology> { private readonly DevHiveContext _context; @@ -18,7 +18,6 @@ namespace DevHive.Data.Repositories #region Create - public async Task<bool> AddAsync(Technology entity) { await this._context @@ -37,22 +36,6 @@ namespace DevHive.Data.Repositories .Set<Technology>() .FindAsync(id); } - - public async Task<bool> DoesTechnologyNameExist(string technologyName) - { - return await this._context - .Set<Technology>() - .AsNoTracking() - .AnyAsync(r => r.Name == technologyName); - } - - public async Task<bool> DoesTechnologyExist(Guid id) - { - return await this._context - .Set<Technology>() - .AsNoTracking() - .AnyAsync(r => r.Id == id); - } #endregion #region Edit @@ -78,5 +61,22 @@ namespace DevHive.Data.Repositories return await RepositoryMethods.SaveChangesAsync(this._context); } #endregion + + #region Validations + + public async Task<bool> DoesTechnologyNameExist(string technologyName) + { + return await this._context + .Set<Technology>() + .AsNoTracking() + .AnyAsync(r => r.Name == technologyName); + } + + public async Task<bool> DoesTechnologyExistAsync(Guid id) + { + return await this._context.Technologies + .AnyAsync(x => x.Id == id); + } + #endregion } }
\ No newline at end of file |
