diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-01-31 14:15:29 +0200 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-01-31 14:15:29 +0200 |
| commit | 37463d3e15097eb0e854e6f7a6d758a82fa1633a (patch) | |
| tree | 92f87d607545d7d2698bc2efa0be4ff93e28254d | |
| parent | 1d6326e7bf14967c670247bea042c92a0a7ee94e (diff) | |
| download | DevHive-37463d3e15097eb0e854e6f7a6d758a82fa1633a.tar DevHive-37463d3e15097eb0e854e6f7a6d758a82fa1633a.tar.gz DevHive-37463d3e15097eb0e854e6f7a6d758a82fa1633a.zip | |
Fixed post update
| -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); |
