From a307f68fc3a5d026febb61821d38a57667ce492e Mon Sep 17 00:00:00 2001 From: "victor.gaborit" Date: Sat, 24 Feb 2024 19:51:55 +0100 Subject: [PATCH] =?UTF-8?q?correction=20du=20bug=20sur=20le=20renvoie=20d'?= =?UTF-8?q?un=20object=20non=20s=C3=A9rializable=20par=20la=20m=C3=A9thode?= =?UTF-8?q?=20UpdatItem=20qui=20provoquait=20une=20erreur=20500=20cot?= =?UTF-8?q?=C3=A9=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API_SQLuedo/ModelToEntity/Extension.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/API_SQLuedo/ModelToEntity/Extension.cs b/API_SQLuedo/ModelToEntity/Extension.cs index 6a14122..72ff9ba 100644 --- a/API_SQLuedo/ModelToEntity/Extension.cs +++ b/API_SQLuedo/ModelToEntity/Extension.cs @@ -49,7 +49,7 @@ namespace ModelToEntity where T : class where TDto : class { - var entity = context.Set().FindAsync(id); + var entity = context.Set().Find(id); if (entity == null) { throw new ArgumentException("Impossible de trouver l'entité", nameof(id)); @@ -65,9 +65,9 @@ namespace ModelToEntity } context.Entry(entity).State = EntityState.Modified; - context.SaveChangesAsync(); + context.SaveChanges(); - return Task.FromResult(entity as T); + return Task.FromResult(entity); } }