From 56f5578d5f93a56984deb6735dba51551868f6d8 Mon Sep 17 00:00:00 2001 From: transtrike Date: Tue, 12 Jan 2021 20:45:14 +0200 Subject: Full implementation of Language & Technologies to User --- .../Repositories/TechnologyRepository.cs | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 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 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 + public class TechnologyRepository : IRepository { private readonly DevHiveContext _context; @@ -18,7 +18,6 @@ namespace DevHive.Data.Repositories #region Create - public async Task AddAsync(Technology entity) { await this._context @@ -37,22 +36,6 @@ namespace DevHive.Data.Repositories .Set() .FindAsync(id); } - - public async Task DoesTechnologyNameExist(string technologyName) - { - return await this._context - .Set() - .AsNoTracking() - .AnyAsync(r => r.Name == technologyName); - } - - public async Task DoesTechnologyExist(Guid id) - { - return await this._context - .Set() - .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 DoesTechnologyNameExist(string technologyName) + { + return await this._context + .Set() + .AsNoTracking() + .AnyAsync(r => r.Name == technologyName); + } + + public async Task DoesTechnologyExistAsync(Guid id) + { + return await this._context.Technologies + .AnyAsync(x => x.Id == id); + } + #endregion } } \ No newline at end of file -- cgit v1.2.3