From 58178d5036f65bb4896fea08bbec9388a8ab8c20 Mon Sep 17 00:00:00 2001 From: transtrike Date: Thu, 21 Jan 2021 19:41:28 +0200 Subject: Code cleanup & consistency --- .../Repositories/TechnologyRepository.cs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'src/DevHive.Data/Repositories/TechnologyRepository.cs') 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 AddAsync(Technology entity) { - await this._context - .Set() + 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 GetByIdAsync(Guid id) { - return await this._context - .Set() + return await this._context.Technologies .FindAsync(id); } public async Task GetByNameAsync(string technologyName) @@ -46,11 +42,9 @@ namespace DevHive.Data.Repositories #endregion #region Edit - public async Task EditAsync(Technology newEntity) { - this._context - .Set() + 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 DeleteAsync(Technology entity) { - this._context - .Set() + 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 DoesTechnologyNameExistAsync(string technologyName) { - return await this._context - .Set() + return await this._context.Technologies .AsNoTracking() .AnyAsync(r => r.Name == technologyName); } -- cgit v1.2.3