Deleted Conseil.cs + updated Monstre attributes to automatic property, removed backing field of them + removed not needed member initializer

pull/32/head
ImNicolasTheDev 2 years ago
parent d051a9e675
commit da355ce300

@ -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
{
/// <summary>
/// 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
/// </summary>
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()
{
}*/
}
}

@ -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<string> CharacteristicsList
{
get {
return characteristic;
}
set {
characteristic = value;
}
get; private init;
}
private List<string> characteristic = null!;
public List<string> AppearanceList
{
get => appearance;
set
{
appearance = value;
}
get; private init;
}
private List<string> appearance = null!;
public Monstre(int id, string name, string danger, string desc, List<string> characList, List<string> appearList)
{

@ -21,7 +21,7 @@ namespace Model
private string Mdp { get; set; }
public List<Monstre>? 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<Monstre>? 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<Monstre> monstresVus)
{
Pseudo = pseudo;
Nom = nom;
Prenom = prenom;

Loading…
Cancel
Save