diff options
| author | transtrike <transtrike@gmail.com> | 2021-01-31 18:55:48 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-01-31 18:55:48 +0200 |
| commit | 0ed4c282dc64ad44229b949559f931e9aae2e047 (patch) | |
| tree | f00a0ffb4bc88e72c7cea62dcfce43c834f527ea /src/DevHive.Data | |
| parent | a7634bc21adf4846aadbd6caeaa357f999e6a3a2 (diff) | |
| parent | b9e895aa1bd579696085f52fdf56970736634e87 (diff) | |
| download | DevHive-0ed4c282dc64ad44229b949559f931e9aae2e047.tar DevHive-0ed4c282dc64ad44229b949559f931e9aae2e047.tar.gz DevHive-0ed4c282dc64ad44229b949559f931e9aae2e047.zip | |
Merge branch 'dev' of github.com:Team-Kaleidoscope/DevHive into dev
Diffstat (limited to 'src/DevHive.Data')
| -rw-r--r-- | src/DevHive.Data/Repositories/PostRepository.cs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/DevHive.Data/Repositories/PostRepository.cs b/src/DevHive.Data/Repositories/PostRepository.cs index 07b5875..f9f2475 100644 --- a/src/DevHive.Data/Repositories/PostRepository.cs +++ b/src/DevHive.Data/Repositories/PostRepository.cs @@ -24,6 +24,7 @@ namespace DevHive.Data.Repositories return await this._context.Posts .Include(x => x.Comments) .Include(x => x.Creator) + .Include(x => x.Rating) .FirstOrDefaultAsync(x => x.Id == id); } @@ -44,6 +45,7 @@ namespace DevHive.Data.Repositories public override async Task<bool> EditAsync(Guid id, Post newEntity) { Post post = await this.GetByIdAsync(id); + var ratingId = post.RatingId; this._context .Entry(post) @@ -58,6 +60,8 @@ namespace DevHive.Data.Repositories foreach(var comment in newEntity.Comments) post.Comments.Add(comment); + post.RatingId = ratingId; + this._context.Entry(post).State = EntityState.Modified; return await this.SaveChangesAsync(this._context); |
