aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Data/Repositories/LanguageRepository.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DevHive.Data/Repositories/LanguageRepository.cs')
-rw-r--r--src/DevHive.Data/Repositories/LanguageRepository.cs43
1 files changed, 2 insertions, 41 deletions
diff --git a/src/DevHive.Data/Repositories/LanguageRepository.cs b/src/DevHive.Data/Repositories/LanguageRepository.cs
index 59c88a6..d7ee609 100644
--- a/src/DevHive.Data/Repositories/LanguageRepository.cs
+++ b/src/DevHive.Data/Repositories/LanguageRepository.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 LanguageRepository : BaseRepository, ILanguageRepository
+ public class LanguageRepository : BaseRepository<Language>, ILanguageRepository
{
private readonly DevHiveContext _context;
public LanguageRepository(DevHiveContext context)
+ :base(context)
{
this._context = context;
}
- #region Create
- public async Task<bool> AddAsync(Language entity)
- {
- await this._context.Languages
- .AddAsync(entity);
-
- return await this.SaveChangesAsync(this._context);
- }
- #endregion
-
#region Read
- public async Task<Language> GetByIdAsync(Guid id)
- {
- return await this._context.Languages
- .FindAsync(id);
- }
-
public async Task<Language> GetByNameAsync(string languageName)
{
return await this._context.Languages
@@ -41,29 +25,6 @@ namespace DevHive.Data.Repositories
}
#endregion
- #region Update
-
- public async Task<bool> EditAsync(Language entity)
- {
- Language language = await this._context.Languages
- .FirstOrDefaultAsync(x => x.Id == entity.Id);
-
- this._context.Update(language);
- this._context.Entry(entity).CurrentValues.SetValues(entity);
-
- return await this.SaveChangesAsync(this._context);
- }
- #endregion
-
- #region Delete
- public async Task<bool> DeleteAsync(Language entity)
- {
- this._context.Languages.Remove(entity);
-
- return await this.SaveChangesAsync(this._context);
- }
- #endregion
-
#region Validations
public async Task<bool> DoesLanguageNameExistAsync(string languageName)
{