aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Data/Repositories/TechnologyRepository.cs
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-01-21 22:08:50 +0200
committertranstrike <transtrike@gmail.com>2021-01-21 22:08:50 +0200
commitbda98b96433d7a9952524fab4ec65f96998b55de (patch)
tree59f8d2bf63b03bacc76f98114d2aed78e420ddcd /src/DevHive.Data/Repositories/TechnologyRepository.cs
parentfb527cbfb94e2723113d67b83ed8f24e32422e56 (diff)
downloadDevHive-bda98b96433d7a9952524fab4ec65f96998b55de.tar
DevHive-bda98b96433d7a9952524fab4ec65f96998b55de.tar.gz
DevHive-bda98b96433d7a9952524fab4ec65f96998b55de.zip
Generic base repo class refactored; All repos inherit generic base repo
Diffstat (limited to 'src/DevHive.Data/Repositories/TechnologyRepository.cs')
-rw-r--r--src/DevHive.Data/Repositories/TechnologyRepository.cs39
1 files changed, 2 insertions, 37 deletions
diff --git a/src/DevHive.Data/Repositories/TechnologyRepository.cs b/src/DevHive.Data/Repositories/TechnologyRepository.cs
index 35ee567..83cc7aa 100644
--- a/src/DevHive.Data/Repositories/TechnologyRepository.cs
+++ b/src/DevHive.Data/Repositories/TechnologyRepository.cs
@@ -1,38 +1,22 @@
using System;
using System.Threading.Tasks;
-using DevHive.Common.Models.Misc;
using DevHive.Data.Interfaces.Repositories;
using DevHive.Data.Models;
using Microsoft.EntityFrameworkCore;
-
namespace DevHive.Data.Repositories
{
- public class TechnologyRepository : BaseRepository, ITechnologyRepository
+ public class TechnologyRepository : BaseRepository<Technology>, ITechnologyRepository
{
private readonly DevHiveContext _context;
public TechnologyRepository(DevHiveContext context)
+ :base(context)
{
this._context = context;
}
- #region Create
- public async Task<bool> AddAsync(Technology entity)
- {
- await this._context.Technologies
- .AddAsync(entity);
-
- return await this.SaveChangesAsync(this._context);
- }
- #endregion
-
#region Read
- public async Task<Technology> GetByIdAsync(Guid id)
- {
- return await this._context.Technologies
- .FindAsync(id);
- }
public async Task<Technology> GetByNameAsync(string technologyName)
{
return await this._context.Technologies
@@ -41,25 +25,6 @@ namespace DevHive.Data.Repositories
}
#endregion
- #region Edit
- public async Task<bool> EditAsync(Technology newEntity)
- {
- this._context.Technologies.Update(newEntity);
-
- return await this.SaveChangesAsync(this._context);
- }
- #endregion
-
- #region Delete
- public async Task<bool> DeleteAsync(Technology entity)
- {
- this._context.Technologies
- .Remove(entity);
-
- return await this.SaveChangesAsync(this._context);
- }
- #endregion
-
#region Validations
public async Task<bool> DoesTechnologyNameExistAsync(string technologyName)
{