From 8f366b4003288de0751442160016bc0065b59a64 Mon Sep 17 00:00:00 2001 From: "ilona.cardot" Date: Thu, 12 Sep 2024 10:34:40 +0200 Subject: [PATCH] =?UTF-8?q?modification=20de=20la=20m=C3=A9thode=20ajouter?= =?UTF-8?q?=20et=20de=20la=20m=C3=A9thode=20supprimer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/métiers/Commande.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/métiers/Commande.java b/src/métiers/Commande.java index 1bfeb60..2a2829a 100644 --- a/src/métiers/Commande.java +++ b/src/métiers/Commande.java @@ -43,6 +43,7 @@ private final HashMap lesLignes = new HashMap<>(); }else { ajoutOK = true; lesLignes.put(unInstrument,qte); + unInstrument.setQteStock(qteDisponible-qte); } return ajoutOK; } @@ -53,7 +54,14 @@ private final HashMap lesLignes = new HashMap<>(); */ public boolean supprimer(Instrument unInstrument){ //lesLignes.remove(unInstrument); - + boolean suppOK; + if (lesLignes.containsValue(unInstrument) == true){ + suppOK = true; + lesLignes.remove(unInstrument); + } else { + suppOK = false; + } + return suppOK; } /////////////////////////////////////////////////////////////////////////////////