diff options
Diffstat (limited to 'src')
| -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); |
