From 33b5f6297c2c975bec8a74a8facc208261c03c9e Mon Sep 17 00:00:00 2001 From: transtrike Date: Tue, 19 Jan 2021 20:36:39 +0200 Subject: Replaced RepoMethods with BaseClass and inherited it where needed --- src/DevHive.Data/Repositories/UserRepository.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/DevHive.Data/Repositories/UserRepository.cs') diff --git a/src/DevHive.Data/Repositories/UserRepository.cs b/src/DevHive.Data/Repositories/UserRepository.cs index 6d4a0bf..81c974c 100644 --- a/src/DevHive.Data/Repositories/UserRepository.cs +++ b/src/DevHive.Data/Repositories/UserRepository.cs @@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore; namespace DevHive.Data.Repositories { - public class UserRepository : IUserRepository + public class UserRepository : BaseRepository, IUserRepository { private readonly DevHiveContext _context; @@ -25,7 +25,7 @@ namespace DevHive.Data.Repositories await this._context.Users .AddAsync(entity); - return await RepositoryMethods.SaveChangesAsync(this._context); + return await this.SaveChangesAsync(this._context); } public async Task AddFriendToUserAsync(User user, User friend) @@ -33,7 +33,7 @@ namespace DevHive.Data.Repositories this._context.Update(user); user.Friends.Add(friend); - return await RepositoryMethods.SaveChangesAsync(this._context); + return await this.SaveChangesAsync(this._context); } public async Task AddLanguageToUserAsync(User user, Language language) @@ -42,7 +42,7 @@ namespace DevHive.Data.Repositories user.Languages.Add(language); - return await RepositoryMethods.SaveChangesAsync(this._context); + return await this.SaveChangesAsync(this._context); } public async Task AddTechnologyToUserAsync(User user, Technology technology) @@ -51,7 +51,7 @@ namespace DevHive.Data.Repositories user.Technologies.Add(technology); - return await RepositoryMethods.SaveChangesAsync(this._context); + return await this.SaveChangesAsync(this._context); } #endregion @@ -116,7 +116,7 @@ namespace DevHive.Data.Repositories .CurrentValues .SetValues(newEntity); - return await RepositoryMethods.SaveChangesAsync(this._context); + return await this.SaveChangesAsync(this._context); } public async Task EditUserLanguageAsync(User user, Language oldLang, Language newLang) @@ -126,7 +126,7 @@ namespace DevHive.Data.Repositories user.Languages.Remove(oldLang); user.Languages.Add(newLang); - return await RepositoryMethods.SaveChangesAsync(this._context); + return await this.SaveChangesAsync(this._context); } public async Task EditUserTechnologyAsync(User user, Technology oldTech, Technology newTech) @@ -136,7 +136,7 @@ namespace DevHive.Data.Repositories user.Technologies.Remove(oldTech); user.Technologies.Add(newTech); - return await RepositoryMethods.SaveChangesAsync(this._context); + return await this.SaveChangesAsync(this._context); } #endregion @@ -147,7 +147,7 @@ namespace DevHive.Data.Repositories this._context.Users .Remove(entity); - return await RepositoryMethods.SaveChangesAsync(this._context); + return await this.SaveChangesAsync(this._context); } public async Task RemoveFriendAsync(User user, User friend) @@ -155,7 +155,7 @@ namespace DevHive.Data.Repositories this._context.Update(user); user.Friends.Remove(friend); - return await RepositoryMethods.SaveChangesAsync(this._context); + return await this.SaveChangesAsync(this._context); } public async Task RemoveLanguageFromUserAsync(User user, Language language) @@ -164,7 +164,7 @@ namespace DevHive.Data.Repositories user.Languages.Remove(language); - return await RepositoryMethods.SaveChangesAsync(this._context); + return await this.SaveChangesAsync(this._context); } public async Task RemoveTechnologyFromUserAsync(User user, Technology technology) @@ -173,7 +173,7 @@ namespace DevHive.Data.Repositories user.Technologies.Remove(technology); - return await RepositoryMethods.SaveChangesAsync(this._context); + return await this.SaveChangesAsync(this._context); } #endregion -- cgit v1.2.3