diff options
| author | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-01-21 19:30:45 +0200 |
|---|---|---|
| committer | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-01-21 19:30:45 +0200 |
| commit | a7acda35c6355c6f896eb2052e37ef23eb02ba02 (patch) | |
| tree | 068ae41b517d42cff5b3540092e4721e3dab628b /src/DevHive.Data/Repositories/UserRepository.cs | |
| parent | 4417b86ccd570f1f5637afc7460ef70fcf1c47c2 (diff) | |
| parent | f8f3727319a03eb9dd9a2ed8546810beb732cdab (diff) | |
| download | DevHive-a7acda35c6355c6f896eb2052e37ef23eb02ba02.tar DevHive-a7acda35c6355c6f896eb2052e37ef23eb02ba02.tar.gz DevHive-a7acda35c6355c6f896eb2052e37ef23eb02ba02.zip | |
Merge branch 'refactor_user_updating' of https://github.com/Team-Kaleidoscope/DevHive into refactor_user_updating
Diffstat (limited to 'src/DevHive.Data/Repositories/UserRepository.cs')
| -rw-r--r-- | src/DevHive.Data/Repositories/UserRepository.cs | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/src/DevHive.Data/Repositories/UserRepository.cs b/src/DevHive.Data/Repositories/UserRepository.cs index c769f7e..f0c28f1 100644 --- a/src/DevHive.Data/Repositories/UserRepository.cs +++ b/src/DevHive.Data/Repositories/UserRepository.cs @@ -2,11 +2,9 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using DevHive.Common.Models.Misc; using DevHive.Data.Interfaces.Repositories; using DevHive.Data.Models; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.ChangeTracking; namespace DevHive.Data.Repositories { @@ -28,32 +26,6 @@ namespace DevHive.Data.Repositories return await this.SaveChangesAsync(this._context); } - - public async Task<bool> AddFriendToUserAsync(User user, User friend) - { - this._context.Update(user); - user.Friends.Add(friend); - - return await this.SaveChangesAsync(this._context); - } - - public async Task<bool> AddLanguageToUserAsync(User user, Language language) - { - this._context.Update(user); - - user.Languages.Add(language); - - return await this.SaveChangesAsync(this._context); - } - - public async Task<bool> AddTechnologyToUserAsync(User user, Technology technology) - { - this._context.Update(user); - - user.Technologies.Add(technology); - - return await this.SaveChangesAsync(this._context); - } #endregion #region Read @@ -120,26 +92,6 @@ namespace DevHive.Data.Repositories return await this.SaveChangesAsync(this._context); } - - public async Task<bool> EditUserLanguageAsync(User user, Language oldLang, Language newLang) - { - this._context.Update(user); - - user.Languages.Remove(oldLang); - user.Languages.Add(newLang); - - return await this.SaveChangesAsync(this._context); - } - - public async Task<bool> EditUserTechnologyAsync(User user, Technology oldTech, Technology newTech) - { - this._context.Update(user); - - user.Technologies.Remove(oldTech); - user.Technologies.Add(newTech); - - return await this.SaveChangesAsync(this._context); - } #endregion #region Delete @@ -151,32 +103,6 @@ namespace DevHive.Data.Repositories return await this.SaveChangesAsync(this._context); } - - public async Task<bool> RemoveFriendAsync(User user, User friend) - { - this._context.Update(user); - user.Friends.Remove(friend); - - return await this.SaveChangesAsync(this._context); - } - - public async Task<bool> RemoveLanguageFromUserAsync(User user, Language language) - { - this._context.Update(user); - - user.Languages.Remove(language); - - return await this.SaveChangesAsync(this._context); - } - - public async Task<bool> RemoveTechnologyFromUserAsync(User user, Technology technology) - { - this._context.Update(user); - - user.Technologies.Remove(technology); - - return await this.SaveChangesAsync(this._context); - } #endregion #region Validations |
