diff options
| author | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-01-21 19:36:49 +0200 |
|---|---|---|
| committer | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-01-21 19:36:49 +0200 |
| commit | 833c4e183581bc69102d66872b4b5bb157d80821 (patch) | |
| tree | 2ada98ee24f5d306739a5d47dee915abb2d72505 /src/DevHive.Data/Repositories/TechnologyRepository.cs | |
| parent | a7acda35c6355c6f896eb2052e37ef23eb02ba02 (diff) | |
| download | DevHive-833c4e183581bc69102d66872b4b5bb157d80821.tar DevHive-833c4e183581bc69102d66872b4b5bb157d80821.tar.gz DevHive-833c4e183581bc69102d66872b4b5bb157d80821.zip | |
Refactored Technology repo edit method
Diffstat (limited to 'src/DevHive.Data/Repositories/TechnologyRepository.cs')
| -rw-r--r-- | src/DevHive.Data/Repositories/TechnologyRepository.cs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/DevHive.Data/Repositories/TechnologyRepository.cs b/src/DevHive.Data/Repositories/TechnologyRepository.cs index a41d4fb..6853893 100644 --- a/src/DevHive.Data/Repositories/TechnologyRepository.cs +++ b/src/DevHive.Data/Repositories/TechnologyRepository.cs @@ -46,12 +46,13 @@ namespace DevHive.Data.Repositories #endregion #region Edit - - public async Task<bool> EditAsync(Technology newEntity) + public async Task<bool> EditAsync(Technology entity) { - this._context - .Set<Technology>() - .Update(newEntity); + Technology technology = await this._context.Technologies + .FirstOrDefaultAsync(x => x.Id == entity.Id); + + this._context.Update(technology); + this._context.Entry(entity).CurrentValues.SetValues(entity); return await this.SaveChangesAsync(this._context); } |
