diff --git a/Sources/Modèle/Conseil.cs b/Sources/Modèle/Conseil.cs deleted file mode 100644 index 37e901b..0000000 --- a/Sources/Modèle/Conseil.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Model; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - - -namespace Modèle -{ - /// - /// La classe conseil permet à un utilisateur de poster un conseil sur la page d'un monstre. - /// Il est composé d'un auteur(public), un texte(string), un monstre(Monstre) ainsi que - /// deux méthodes : addConseil et removeConseil - /// - public class Conseil - { - /* - public User Auteur { get; set; } - public string Texte { get; private set; } - public Monstre LeMonstre { get; set; } - - public Conseil(User auteur, string texte, Monstre monstre) - { - // Test pour voir si le conseil est vide - if ( string.IsNullOrWhiteSpace(texte) ) - { - throw new ArgumentException("Vous ne pouvez pas postez un commentaire sans texte !"); - } - - // Essaye de convertir le paramètre monstre en int - // Problème je pense que le type Monstre ne va pas - bool isMonstreNumeric = int.TryParse(monstre, out _); - - // Test si le nom du monstre est correct - if ( isMonstreNumeric ) - { - throw new FormatException("Veuillez entrer un nom de Monstre correct."); - } - - - Auteur = auteur; - Texte = texte; - LeMonstre = monstre; - } - - public void addConseil() - { - - } - - public void removeConseil() - { - - }*/ - - } -} diff --git a/Sources/Modèle/Monstre.cs b/Sources/Modèle/Monstre.cs index 47cebc1..3dd77ba 100644 --- a/Sources/Modèle/Monstre.cs +++ b/Sources/Modèle/Monstre.cs @@ -5,36 +5,25 @@ namespace Model; public class Monstre { - public int Id { get; set; } = 1; + public int Id { get; set; } public string Name { get; set; } public string Dangerosite { get; private init; } //EN FAIT IL FAUDRAIT FAIRE UN ENUM DU TYPE DE DANGEROSITÉ, pour rajouter lors de //l'affichage de la liste des monstres une couleur selon ça, //genre rouge dangereux, violet hyper dangereux, et vert passif - public string Description { get; set; } = string.Empty; + public string Description { get; set; } public List CharacteristicsList { - get { - return characteristic; - } - set { - characteristic = value; - } + get; private init; } - private List characteristic = null!; public List AppearanceList { - get => appearance; - set - { - appearance = value; - } + get; private init; } - private List appearance = null!; public Monstre(int id, string name, string danger, string desc, List characList, List appearList) { diff --git a/Sources/Modèle/User.cs b/Sources/Modèle/User.cs index ac5af16..b743321 100644 --- a/Sources/Modèle/User.cs +++ b/Sources/Modèle/User.cs @@ -21,7 +21,7 @@ namespace Model private string Mdp { get; set; } public List? monstresDejaVu { get; private set; } - public User(string pseudo, string nom, string prenom, string mdp) + public User(string pseudo, string nom, string prenom, string mdp, List? monstresVus = null) { if (string.IsNullOrWhiteSpace(pseudo) || string.IsNullOrWhiteSpace(nom) || string.IsNullOrWhiteSpace(prenom) || string.IsNullOrWhiteSpace(mdp)) { @@ -34,20 +34,11 @@ namespace Model bool isPrenomNumeric = int.TryParse(prenom, out _); //Si une des variables est convertissable en int, alors c'est une chaine de caractère uniquement composée de nombres - if ( isPseudoNumeric || isNomNumeric || isPrenomNumeric ) + if (isPseudoNumeric || isNomNumeric || isPrenomNumeric) { //Alors on renvoie une exception appelée "FormatException" throw new FormatException("Un User ne peux pas avoir de pseudo/nom/prénom composé uniquement de nombres !"); } - - Pseudo = pseudo; - Nom = nom; - Prenom = prenom; - Mdp = mdp; - } - - public User(string pseudo, string nom, string prenom, string mdp, List monstresVus) - { Pseudo = pseudo; Nom = nom; Prenom = prenom;