diff options
| author | transtrike <transtrike@gmail.com> | 2021-01-28 01:08:31 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-01-28 01:08:31 +0200 |
| commit | e632e9241e8afe530f6b37cb683b211769135c45 (patch) | |
| tree | 37674ce51d0ce272bb9ddd8535bf67956f01a3cb /src/DevHive.Data/Repositories/BaseRepository.cs | |
| parent | f8e17868c617e1734c0e77e58a8318300a5b663a (diff) | |
| download | DevHive-e632e9241e8afe530f6b37cb683b211769135c45.tar DevHive-e632e9241e8afe530f6b37cb683b211769135c45.tar.gz DevHive-e632e9241e8afe530f6b37cb683b211769135c45.zip | |
USER UPDATE FIIIIIIXED
Diffstat (limited to 'src/DevHive.Data/Repositories/BaseRepository.cs')
| -rw-r--r-- | src/DevHive.Data/Repositories/BaseRepository.cs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/DevHive.Data/Repositories/BaseRepository.cs b/src/DevHive.Data/Repositories/BaseRepository.cs index 0a97ac1..f1e6673 100644 --- a/src/DevHive.Data/Repositories/BaseRepository.cs +++ b/src/DevHive.Data/Repositories/BaseRepository.cs @@ -13,7 +13,6 @@ namespace DevHive.Data.Repositories public BaseRepository(DbContext context) { this._context = context; - this._context.ChangeTracker.AutoDetectChangesEnabled = false; } public virtual async Task<bool> AddAsync(TEntity entity) @@ -34,11 +33,11 @@ namespace DevHive.Data.Repositories public virtual async Task<bool> EditAsync(Guid id, TEntity newEntity) { - TEntity currEnt = await this.GetByIdAsync(id); - this._context - .Entry(currEnt) - .CurrentValues - .SetValues(newEntity); + var entry = this._context.Entry(newEntity); + if (entry.State == EntityState.Detached) + this._context.Attach(newEntity); + + entry.State = EntityState.Modified; return await this.SaveChangesAsync(_context); } |
