From 3f58547a015d5875de694ea852aaf1a552705b20 Mon Sep 17 00:00:00 2001 From: Corentin R <76619184+Koroh63@users.noreply.github.com> Date: Sun, 26 Mar 2023 22:16:01 +0200 Subject: [PATCH] fix error --- Sources/API_LoL/Controllers/RunesController.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Sources/API_LoL/Controllers/RunesController.cs b/Sources/API_LoL/Controllers/RunesController.cs index 418cf4a..bf7d75f 100644 --- a/Sources/API_LoL/Controllers/RunesController.cs +++ b/Sources/API_LoL/Controllers/RunesController.cs @@ -80,10 +80,11 @@ namespace API_LoL.Controllers else { var champ = await RunesManager.GetItemsByName(rune.Name, 0, 1); - if (champ.FirstOrDefault() != null && champ.Count() != 0 && champ.FirstOrDefault().Name == rune.Name) - { - return Conflict(rune); - } + if(champ.Count() > 0) + if (champ.Where(c => c.Name == rune.Name).Count() == 1) + { + return Conflict(rune); + } await RunesManager.AddItem(rune.ToRune()); return CreatedAtAction("Post", rune);