aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Data/Repositories
diff options
context:
space:
mode:
Diffstat (limited to 'src/DevHive.Data/Repositories')
-rw-r--r--src/DevHive.Data/Repositories/TechnologyRepository.cs36
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