diff options
Diffstat (limited to 'src/DevHive.Data/Repositories/TechnologyRepository.cs')
| -rw-r--r-- | src/DevHive.Data/Repositories/TechnologyRepository.cs | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/DevHive.Data/Repositories/TechnologyRepository.cs b/src/DevHive.Data/Repositories/TechnologyRepository.cs index a41d4fb..597a532 100644 --- a/src/DevHive.Data/Repositories/TechnologyRepository.cs +++ b/src/DevHive.Data/Repositories/TechnologyRepository.cs @@ -18,11 +18,9 @@ namespace DevHive.Data.Repositories } #region Create - public async Task<bool> AddAsync(Technology entity) { - await this._context - .Set<Technology>() + await this._context.Technologies .AddAsync(entity); return await this.SaveChangesAsync(this._context); @@ -30,11 +28,9 @@ namespace DevHive.Data.Repositories #endregion #region Read - public async Task<Technology> GetByIdAsync(Guid id) { - return await this._context - .Set<Technology>() + return await this._context.Technologies .FindAsync(id); } public async Task<Technology> GetByNameAsync(string technologyName) @@ -46,11 +42,9 @@ namespace DevHive.Data.Repositories #endregion #region Edit - public async Task<bool> EditAsync(Technology newEntity) { - this._context - .Set<Technology>() + this._context.Technologies .Update(newEntity); return await this.SaveChangesAsync(this._context); @@ -58,11 +52,9 @@ namespace DevHive.Data.Repositories #endregion #region Delete - public async Task<bool> DeleteAsync(Technology entity) { - this._context - .Set<Technology>() + this._context.Technologies .Remove(entity); return await this.SaveChangesAsync(this._context); @@ -70,11 +62,9 @@ namespace DevHive.Data.Repositories #endregion #region Validations - public async Task<bool> DoesTechnologyNameExistAsync(string technologyName) { - return await this._context - .Set<Technology>() + return await this._context.Technologies .AsNoTracking() .AnyAsync(r => r.Name == technologyName); } |
