From 9655382818cdc91998665640a4bfb0e7b5f71eb2 Mon Sep 17 00:00:00 2001 From: Anthony RICHARD Date: Sat, 29 Apr 2023 09:48:16 +0200 Subject: [PATCH] Modification de la classe Review --- Sources/Stim/Stim/Review.cs | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/Sources/Stim/Stim/Review.cs b/Sources/Stim/Stim/Review.cs index 5387ef6..dc15cad 100644 --- a/Sources/Stim/Stim/Review.cs +++ b/Sources/Stim/Stim/Review.cs @@ -8,20 +8,43 @@ namespace Stim { internal class Review { - public float Rate { get; set; } - public string Text { get; set; } + public float Rate + { + get + { + return rate; + } + private set + { + if (value < 0 || value > 5) return; + rate = value; + } + } + private float rate; + + public string Text + { + get + { + return text; + } + private set + { + if (text == "") return; + text = value; + } + } + private string text; public Review(float rate, string text) { - CheckRate(rate); + Rate = rate; Text = text; } - public bool CheckRate(float rate) + public void EditReview(string text) { - if (rate < 0 || rate > 5) return false; - Rate=rate; - return true; + Text = text; } } }