Website Summary Files Commits Branches @commit @diff @stats
path: root / src / DevHive.Data / Repositories / TechnologyRepository.cs
diff options
context:
space:
mode:
Commit58178d5036f65bb4896fea08bbec9388a8ab8c20 (patch)
Author
 transtrike <transtrike@gmail.com>
2021-01-21 19:41:28 +0200
Committer
 transtrike <transtrike@gmail.com>
2021-01-21 19:41:28 +0200
Filesc4e7656a526cc128f7d0e680648e932f16b5f47a /src/DevHive.Data/Repositories/TechnologyRepository.cs
DevHive-58178d5036f65bb4896fea08bbec9388a8ab8c20.tar
DevHive-58178d5036f65bb4896fea08bbec9388a8ab8c20.tar.gz
DevHive-58178d5036f65bb4896fea08bbec9388a8ab8c20.zip
Parentf8f3727319a03eb9dd9a2ed8546810beb732cdab (diff)
Code cleanup & consistency
1 files changed, 5 insertions, 15 deletions
-rw-r--r--src/DevHive.Data/Repositories/TechnologyRepository.cs20
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);
}