diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-02-03 10:22:37 +0200 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-02-03 10:22:37 +0200 |
| commit | 01ad75fa5a871a0c9f8cd0c5291312286ae4d52d (patch) | |
| tree | 4f6b2eaef0424ffbfdd405939fbaa9325cc9d2c8 /src/DevHive.Data/Repositories | |
| parent | 81b3fc43a900857443c3c763f52e0a54719c2fae (diff) | |
| download | DevHive-01ad75fa5a871a0c9f8cd0c5291312286ae4d52d.tar DevHive-01ad75fa5a871a0c9f8cd0c5291312286ae4d52d.tar.gz DevHive-01ad75fa5a871a0c9f8cd0c5291312286ae4d52d.zip | |
Implemented profile picture table functionality; added models and interfaces for profile picture; added ability for user layers to update the profile picture; added migrations; updated mappings
Diffstat (limited to 'src/DevHive.Data/Repositories')
| -rw-r--r-- | src/DevHive.Data/Repositories/UserRepository.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/DevHive.Data/Repositories/UserRepository.cs b/src/DevHive.Data/Repositories/UserRepository.cs index b46198c..466b123 100644 --- a/src/DevHive.Data/Repositories/UserRepository.cs +++ b/src/DevHive.Data/Repositories/UserRepository.cs @@ -38,6 +38,7 @@ namespace DevHive.Data.Repositories .Include(x => x.Languages) .Include(x => x.Technologies) .Include(x => x.Posts) + .Include(x => x.ProfilePicture) .FirstOrDefaultAsync(x => x.Id == id); } @@ -48,6 +49,7 @@ namespace DevHive.Data.Repositories .Include(x => x.Languages) .Include(x => x.Technologies) .Include(x => x.Posts) + .Include(x => x.ProfilePicture) .FirstOrDefaultAsync(x => x.UserName == username); } #endregion @@ -93,6 +95,14 @@ namespace DevHive.Data.Repositories return await this.SaveChangesAsync(); } + + public async Task<bool> UpdateProfilePicture(Guid userId, string pictureUrl) { + User user = await this.GetByIdAsync(userId); + + user.ProfilePicture.PictureURL = pictureUrl; + + return await this.SaveChangesAsync(); + } #endregion #region Validations |
