From 833c4e183581bc69102d66872b4b5bb157d80821 Mon Sep 17 00:00:00 2001 From: Danail Dimitrov Date: Thu, 21 Jan 2021 19:36:49 +0200 Subject: Refactored Technology repo edit method --- src/DevHive.Data/Repositories/TechnologyRepository.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/DevHive.Data/Repositories/TechnologyRepository.cs') 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 EditAsync(Technology newEntity) + public async Task EditAsync(Technology entity) { - this._context - .Set() - .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); } -- cgit v1.2.3