From 98e17766b203734a1817eed94338e2d25f4395f7 Mon Sep 17 00:00:00 2001 From: transtrike Date: Sat, 13 Feb 2021 16:20:18 +0200 Subject: Project Restructure P.1 --- src/DevHive.Data/Repositories/RoleRepository.cs | 55 ------------------------- 1 file changed, 55 deletions(-) delete mode 100644 src/DevHive.Data/Repositories/RoleRepository.cs (limited to 'src/DevHive.Data/Repositories/RoleRepository.cs') diff --git a/src/DevHive.Data/Repositories/RoleRepository.cs b/src/DevHive.Data/Repositories/RoleRepository.cs deleted file mode 100644 index 441efef..0000000 --- a/src/DevHive.Data/Repositories/RoleRepository.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Threading.Tasks; -using DevHive.Data.Interfaces.Repositories; -using DevHive.Data.Models; -using Microsoft.EntityFrameworkCore; - -namespace DevHive.Data.Repositories -{ - public class RoleRepository : BaseRepository, IRoleRepository - { - private readonly DevHiveContext _context; - - public RoleRepository(DevHiveContext context) - : base(context) - { - this._context = context; - } - - #region Read - public async Task GetByNameAsync(string name) - { - return await this._context.Roles - .FirstOrDefaultAsync(x => x.Name == name); - } - #endregion - - public override async Task EditAsync(Guid id, Role newEntity) - { - Role role = await this.GetByIdAsync(id); - - this._context - .Entry(role) - .CurrentValues - .SetValues(newEntity); - - return await this.SaveChangesAsync(); - } - - #region Validations - public async Task DoesNameExist(string name) - { - return await this._context.Roles - .AsNoTracking() - .AnyAsync(r => r.Name == name); - } - - public async Task DoesRoleExist(Guid id) - { - return await this._context.Roles - .AsNoTracking() - .AnyAsync(r => r.Id == id); - } - #endregion - } -} -- cgit v1.2.3