From bf281a327d4d2d57484d9425f3d2b9a617ec2c13 Mon Sep 17 00:00:00 2001 From: "Leana.besson" Date: Thu, 1 Jun 2023 22:19:17 +0200 Subject: [PATCH] Modification du stub pour LoadTheque --- Sources/Console/Program.cs | 707 +++++++++++++++++++------------------ Sources/Model/Espece.cs | 26 +- Sources/Model/Race.cs | 24 +- Sources/Model/Stub.cs | 16 + Sources/Model/Theque.cs | 4 +- Sources/Views/App.xaml.cs | 2 +- 6 files changed, 399 insertions(+), 380 deletions(-) diff --git a/Sources/Console/Program.cs b/Sources/Console/Program.cs index 3a1def7..90dde41 100644 --- a/Sources/Console/Program.cs +++ b/Sources/Console/Program.cs @@ -3,363 +3,366 @@ using System.Collections.ObjectModel; using System.IO; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Json; +using System.Xml; namespace MyProject; class Program { - static private Theque Theque { get; set; } = new(); + static private Theque Theque { get; set; } = Stub.LoadTheque(); static void Main(string[] args) - { - MenusPrincipal(); - } - - static private void MenusPrincipal() - { - while (true) - { - Console.WriteLine("MENUS PRINCIPAL"); - Console.WriteLine("\t1- Les espèces"); - Console.WriteLine("\t2- Vos animaux"); - Console.WriteLine("\t9- Quitter"); - - Console.Write("\n\tEntrer votre choix : "); - int choix = Convert.ToInt32(Console.ReadLine()); - - switch (choix) - { - case 1: - Console.Clear(); - MenusEspece(); - break; - case 2: - Console.Clear(); - MenusAnimal(); - break; - case 9: - return; - default: - Console.WriteLine("\tChoix incorrect\n"); - break; - } - } - } - - static private void MenusEspece() - { - while (true) - { - Console.WriteLine("LES ESPECES"); - Console.WriteLine("\t1- Afficher les espèces"); - Console.WriteLine("\t2- Sélectionner une espèce"); - Console.WriteLine("\t9- Retour"); - - Console.Write("\n\tEntrer votre choix : "); - int choix = Convert.ToInt32(Console.ReadLine()); - - switch (choix) - { - case 1: - Console.Clear(); - AfficherListeEspece(); - break; - case 2: - Console.Clear(); - SelectionnerEspece(); - break; - case 9: - Console.Clear(); - return; - default: - Console.WriteLine("\tChoix incorrect\n"); - break; - } - } - } - - static private void AfficherListeEspece() - { - Console.WriteLine("LISTE DES ESPECES : "); - foreach (Espece espece in Theque.ListeEspeces) - { - Console.WriteLine("\t" + espece.Nom + " (" + espece.NomScientifique + ")"); - } - Console.WriteLine("\n"); - } - - static private void SelectionnerEspece() - { - string choix = ""; - while (choix != "-1") - { - AfficherListeEspece(); - - Console.Write("\n\tEntrer le nom de l'espèce à sélectionner (-1 pour annuler) : "); - choix = Console.ReadLine(); - - Espece? espece = Theque.RechercherEspece(choix); - - if (espece != null) - { - AfficherEspece(espece); - } - else Console.WriteLine("\tChoix incorrect\n"); - } - } - - static private void AfficherEspece(Espece espece) - { - Console.WriteLine("\n" + espece.Nom); - Console.WriteLine("\tNom scientifique : " + espece.NomScientifique); - Console.WriteLine("\tEspérance de vie : " + espece.EsperanceVie); - Console.WriteLine("\tPoids moyen : " + espece.PoidsMoyen); - Console.WriteLine("\tTaille moyenne : " + espece.TailleMoyenne); - Console.WriteLine("\tComportement : " + espece.Comportement); - Console.WriteLine("\tSanté : " + espece.Sante); - Console.WriteLine("\tEducation : " + espece.Education); - Console.WriteLine("\tEntretien : " + espece.Entretien); - Console.WriteLine("\tCout : " + espece.Cout); - Console.WriteLine("\tConseil : " + espece.Conseil); - - AfficherListeRace(espece); - - while (true) - { - Console.WriteLine("\n\t1- Sélectionner une race"); - Console.WriteLine("\t9- Retour"); - - Console.Write("\n\tEntrer votre choix : "); - int decision = Convert.ToInt32(Console.ReadLine()); - - switch (decision) - { - case 1: - SelectionnerRace(espece); - break; - case 9: - return; - default: - Console.WriteLine("\tChoix incorrect\n"); - break; - } - } - } - - static private void AfficherListeRace(Espece espece) - { - Console.WriteLine("\nLISTE DES RACES : "); - if (espece.ListeRaces != null) - { - foreach (Race race in espece.ListeRaces) - { - Console.WriteLine("\t" + race.Nom + " (" + race.NomScientifique + ")"); - } - Console.WriteLine("\n"); - } - else Console.WriteLine("\tAucune race connue.\n"); - } - - static private void SelectionnerRace(Espece espece) - { - string choix = ""; - while (choix != "-1") - { - Console.Write("\n\tEntrer le nom de la race à sélectionner (-1 pour annuler) : "); - choix = Console.ReadLine(); - - if (choix != "-1") - { - Race? race = espece.RechercherRace(choix); - - if (race != null) - { - AfficherRace(race); - } - else Console.WriteLine("\tChoix incorrect\n"); - } - } - } - - static private void AfficherRace(Race race) - { - Console.WriteLine("\n " + race.Nom); - Console.WriteLine("\tNom scientifique : " + race.NomScientifique); - Console.WriteLine("\tEspérance de vie : " + race.EsperanceVie); - Console.WriteLine("\tPoids moyen : " + race.PoidsMoyen); - Console.WriteLine("\tTaille moyenne : " + race.TailleMoyenne); - Console.WriteLine("\tComportement : " + race.Comportement); - Console.WriteLine("\tSante : " + race.Sante); - Console.WriteLine("\tEducation : " + race.Education); - Console.WriteLine("\tEntretien : " + race.Entretien); - Console.WriteLine("\tCout : " + race.Cout); - Console.WriteLine("\tConseil : " + race.Conseil + "\n\n"); - } - - static private void MenusAnimal() - { - while (true) - { - Console.WriteLine("LES ANIMAUX"); - Console.WriteLine("\t1- Afficher les animaux"); - Console.WriteLine("\t2- Ajouter un animal"); - Console.WriteLine("\t3- Sélectionner un animal"); - Console.WriteLine("\t9- Retour"); - - Console.Write("\n\tEntrer votre choix : "); - int choix = Convert.ToInt32(Console.ReadLine()); - - switch (choix) - { - case 1: - Console.Clear(); - AfficherListeAnimaux(); - break; - case 2: - Console.Clear(); - Animal animal = Theque.AjouterAnimal(); - ModifierNom(animal); - ModifierAnimal(animal); - break; - case 3: - Console.Clear(); - SelectionnerAnimal(); - break; - case 9: - Console.Clear(); - return; - default: - Console.WriteLine("\tChoix incorrect\n"); - break; - } - } - } - - static private void AfficherListeAnimaux() - { - Console.WriteLine("VOS ANIMAUX : "); - foreach (Animal animal in Theque.ListeAnimaux) - { - Console.WriteLine(animal.Nom); - } - } - - static private void SelectionnerAnimal() - { - string choix = ""; - while (choix != "-1") - { - AfficherListeAnimaux(); - - Console.Write("\n\tEntrer le nom de l'animal à sélectionner (-1 pour annuler) : "); - choix = Console.ReadLine(); - - Animal? animal = Theque.RechercherAnimal(choix); - - if (animal != null) - { - AfficherAnimal(animal); - } - else Console.WriteLine("\tChoix incorrect\n"); - } - } - - static private void AfficherAnimal(Animal animal) - { - Console.Clear(); - while (true) - { - Console.WriteLine("\n" + animal.Nom); - if (animal.Espece != null) Console.WriteLine("\tEspece : " + animal.Espece.Nom); - if (animal.Race != null) Console.WriteLine("\tRace : " + animal.Race.Nom); - Console.WriteLine("\tDate de naissance : " + animal.DateNaissance); - Console.WriteLine("\tSexe : " + animal.Sexe); - Console.WriteLine("\tDate d'adoption : " + animal.DateAdoption); - Console.WriteLine("\tTaille : " + animal.Taille); - Console.WriteLine("\tPoids : " + animal.Poids); - Console.WriteLine("\tAlimentation : " + animal.Alimentation); - Console.WriteLine("\tPETSITTER : "); - AfficherEntite(animal.Petsitter); - Console.WriteLine("\tCHENIL : "); - AfficherEntite(animal.Chenil); - Console.WriteLine("\tVETERINAIRE : "); - AfficherEntite(animal.Veterinaire); - Console.WriteLine("\tMAGASIN ALIMENTAIRE : "); - AfficherEntite(animal.MagasinAlimentaire); - Console.WriteLine("\tREFUGE, ELEVAGE, CHENIL DE PROVENANCE : "); - AfficherEntite(animal.Provenance); - - - Console.WriteLine("\n\t1- Modifier"); - Console.WriteLine("\t2- Supprimer"); - Console.WriteLine("\t9- Retour"); - - Console.Write("\n\tEntrer votre choix : "); - int decision = Convert.ToInt32(Console.ReadLine()); - - switch (decision) - { - case 1: - ModifierAnimal(animal); - break; - case 2: - Theque.SupprimerAnimal(animal); - return; - case 9: - return; - default: - Console.WriteLine("\tChoix incorrect\n"); - break; - } - } - } - - static private void AfficherEntite(Entite entite) - { - Console.WriteLine("\t\tNom : " + entite.Nom); - Console.WriteLine("\t\tAdresse : " + entite.Adresse + "," + Convert.ToInt32(entite.CodePostal) + " " + entite.Ville); - Console.WriteLine("\t\tNuméro de téléphone : " + entite.NumTel); - } - - static private void ModifierAnimal(Animal animal) - { - while (true) - { - Console.WriteLine("MODIFIER L'ANIMAL ", animal.Nom); - Console.WriteLine("\t1- Nom"); - Console.WriteLine("\t2- Espece"); - Console.WriteLine("\t3- Race"); - Console.WriteLine("\t4- Date de naissance"); - Console.WriteLine("\t5- Sexe"); - Console.WriteLine("\t6- Date d'adoption"); - Console.WriteLine("\t7- Taille"); - Console.WriteLine("\t8- Poids"); - Console.WriteLine("\t9- Alimentation"); - Console.WriteLine("\t10- Petsitter"); - Console.WriteLine("\t11- Chenil"); - Console.WriteLine("\t12- Vétérinaire"); - Console.WriteLine("\t13- Magasin alimentaire"); - Console.WriteLine("\t14- Refuge, élevage et chenil de provenance"); - Console.WriteLine("\t19- Retour"); - - Console.Write("\n\tEntrer votre choix : "); - int decision = Convert.ToInt32(Console.ReadLine()); - - switch (decision) - { - case 1: - ModifierNom(animal); - break; - case 2: - ModifierEspece(animal); - break; - case 3: - ModifierRace(animal); - break; - case 4: - ModifierDateNaissance(animal); - break; - case 5: - ModifierSexe(animal); - break; + { + MenusPrincipal(); + } + + static private void MenusPrincipal() + { + while (true) + { + Console.WriteLine("MENUS PRINCIPAL"); + Console.WriteLine("\t1- Les espèces"); + Console.WriteLine("\t2- Vos animaux"); + Console.WriteLine("\t9- Quitter"); + + Console.Write("\n\tEntrer votre choix : "); + int choix = Convert.ToInt32(Console.ReadLine()); + + switch (choix) + { + case 1: + Console.Clear(); + MenusEspece(); + break; + case 2: + Console.Clear(); + MenusAnimal(); + break; + case 9: + return; + default: + Console.WriteLine("\tChoix incorrect\n"); + break; + } + } + } + + static private void MenusEspece() + { + while (true) + { + Console.WriteLine("LES ESPECES"); + Console.WriteLine("\t1- Afficher les espèces"); + Console.WriteLine("\t2- Sélectionner une espèce"); + Console.WriteLine("\t9- Retour"); + + Console.Write("\n\tEntrer votre choix : "); + int choix = Convert.ToInt32(Console.ReadLine()); + + switch (choix) + { + case 1: + Console.Clear(); + AfficherListeEspece(); + break; + case 2: + Console.Clear(); + SelectionnerEspece(); + break; + case 9: + Console.Clear(); + return; + default: + Console.WriteLine("\tChoix incorrect\n"); + break; + } + } + } + + static private void AfficherListeEspece() + { + Console.WriteLine("LISTE DES ESPECES : "); + foreach (Espece espece in Theque.ListeEspeces) + { + Console.WriteLine("\t" + espece.Nom + " (" + espece.NomScientifique + ")"); + } + Console.WriteLine("\n"); + } + + static private void SelectionnerEspece() + { + string choix = ""; + while (choix != "-1") + { + AfficherListeEspece(); + + Console.Write("\n\tEntrer le nom de l'espèce à sélectionner (-1 pour annuler) : "); + choix = Console.ReadLine(); + + Espece? espece = Theque.RechercherEspece(choix); + + if (espece != null) + { + AfficherEspece(espece); + } + else Console.WriteLine("\tChoix incorrect\n"); + } + } + + static private void AfficherEspece(Espece espece) + { + Console.WriteLine("\n" + espece.Nom); + Console.WriteLine("\tNom scientifique : " + espece.NomScientifique); + Console.WriteLine("\tEspérance de vie : " + espece.EsperanceVie); + Console.WriteLine("\tPoids moyen : " + espece.PoidsMoyen); + Console.WriteLine("\tTaille moyenne : " + espece.TailleMoyenne); + Console.WriteLine("\tComportement : " + espece.Comportement); + Console.WriteLine("\tSanté : " + espece.Sante); + Console.WriteLine("\tEducation : " + espece.Education); + Console.WriteLine("\tEntretien : " + espece.Entretien); + Console.WriteLine("\tCout : " + espece.Cout); + Console.WriteLine("\tConseil : " + espece.Conseil); + + AfficherListeRace(espece); + + while (true) + { + Console.WriteLine("\n\t1- Sélectionner une race"); + Console.WriteLine("\t9- Retour"); + + Console.Write("\n\tEntrer votre choix : "); + int decision = Convert.ToInt32(Console.ReadLine()); + + switch (decision) + { + case 1: + SelectionnerRace(espece); + break; + case 9: + return; + default: + Console.WriteLine("\tChoix incorrect\n"); + break; + } + } + } + + static private void AfficherListeRace(Espece espece) + { + Console.WriteLine("\nLISTE DES RACES : "); + if (espece.ListeRaces != null) + { + foreach (Race race in espece.ListeRaces) + { + Console.WriteLine("\t" + race.Nom + " (" + race.NomScientifique + ")"); + } + Console.WriteLine("\n"); + } + else Console.WriteLine("\tAucune race connue.\n"); + } + + static private void SelectionnerRace(Espece espece) + { + string choix = ""; + while (choix != "-1") + { + Console.Write("\n\tEntrer le nom de la race à sélectionner (-1 pour annuler) : "); + choix = Console.ReadLine(); + + if (choix != "-1") + { + Race? race = espece.RechercherRace(choix); + + if (race != null) + { + AfficherRace(race); + } + else Console.WriteLine("\tChoix incorrect\n"); + } + } + } + + static private void AfficherRace(Race race) + { + Console.WriteLine("\n " + race.Nom); + Console.WriteLine("\tNom scientifique : " + race.NomScientifique); + Console.WriteLine("\tEspérance de vie : " + race.EsperanceVie); + Console.WriteLine("\tPoids moyen : " + race.PoidsMoyen); + Console.WriteLine("\tTaille moyenne : " + race.TailleMoyenne); + Console.WriteLine("\tComportement : " + race.Comportement); + Console.WriteLine("\tSante : " + race.Sante); + Console.WriteLine("\tEducation : " + race.Education); + Console.WriteLine("\tEntretien : " + race.Entretien); + Console.WriteLine("\tCout : " + race.Cout); + Console.WriteLine("\tConseil : " + race.Conseil + "\n\n"); + } + + static private void MenusAnimal() + { + while (true) + { + Console.WriteLine("LES ANIMAUX"); + Console.WriteLine("\t1- Afficher les animaux"); + Console.WriteLine("\t2- Ajouter un animal"); + Console.WriteLine("\t3- Sélectionner un animal"); + Console.WriteLine("\t9- Retour"); + + Console.Write("\n\tEntrer votre choix : "); + int choix = Convert.ToInt32(Console.ReadLine()); + + switch (choix) + { + case 1: + Console.Clear(); + AfficherListeAnimaux(); + break; + case 2: + Console.Clear(); + Animal animal = Theque.AjouterAnimal(); + ModifierNom(animal); + ModifierAnimal(animal); + break; + case 3: + Console.Clear(); + SelectionnerAnimal(); + break; + case 9: + Console.Clear(); + return; + default: + Console.WriteLine("\tChoix incorrect\n"); + break; + } + } + } + + static private void AfficherListeAnimaux() + { + Console.WriteLine("VOS ANIMAUX : "); + foreach (Animal animal in Theque.ListeAnimaux) + { + Console.WriteLine(animal.Nom); + } + } + + static private void SelectionnerAnimal() + { + string choix = ""; + while (choix != "-1") + { + AfficherListeAnimaux(); + + Console.Write("\n\tEntrer le nom de l'animal à sélectionner (-1 pour annuler) : "); + choix = Console.ReadLine(); + + Animal? animal = Theque.RechercherAnimal(choix); + + if (animal != null) + { + AfficherAnimal(animal); + } + else Console.WriteLine("\tChoix incorrect\n"); + } + } + + static private void AfficherAnimal(Animal animal) + { + Console.Clear(); + while (true) + { + Console.WriteLine("\n" + animal.Nom); + if (animal.Espece != null) Console.WriteLine("\tEspece : " + animal.Espece.Nom); + if (animal.Race != null) Console.WriteLine("\tRace : " + animal.Race.Nom); + Console.WriteLine("\tDate de naissance : " + animal.DateNaissance); + Console.WriteLine("\tSexe : " + animal.Sexe); + Console.WriteLine("\tDate d'adoption : " + animal.DateAdoption); + Console.WriteLine("\tTaille : " + animal.Taille); + Console.WriteLine("\tPoids : " + animal.Poids); + Console.WriteLine("\tAlimentation : " + animal.Alimentation); + Console.WriteLine("\tPETSITTER : "); + AfficherEntite(animal.Petsitter); + Console.WriteLine("\tCHENIL : "); + AfficherEntite(animal.Chenil); + Console.WriteLine("\tVETERINAIRE : "); + AfficherEntite(animal.Veterinaire); + Console.WriteLine("\tMAGASIN ALIMENTAIRE : "); + AfficherEntite(animal.MagasinAlimentaire); + Console.WriteLine("\tREFUGE, ELEVAGE, CHENIL DE PROVENANCE : "); + AfficherEntite(animal.Provenance); + + + Console.WriteLine("\n\t1- Modifier"); + Console.WriteLine("\t2- Supprimer"); + Console.WriteLine("\t9- Retour"); + + Console.Write("\n\tEntrer votre choix : "); + int decision = Convert.ToInt32(Console.ReadLine()); + + switch (decision) + { + case 1: + ModifierAnimal(animal); + break; + case 2: + Theque.SupprimerAnimal(animal); + return; + case 9: + return; + default: + Console.WriteLine("\tChoix incorrect\n"); + break; + } + } + } + + static private void AfficherEntite(Entite entite) + { + Console.WriteLine("\t\tNom : " + entite.Nom); + Console.WriteLine("\t\tAdresse : " + entite.Adresse + "," + Convert.ToInt32(entite.CodePostal) + " " + entite.Ville); + Console.WriteLine("\t\tNuméro de téléphone : " + entite.NumTel); + } + + static private void ModifierAnimal(Animal animal) + { + while (true) + { + Console.WriteLine("MODIFIER L'ANIMAL ", animal.Nom); + Console.WriteLine("\t1- Nom"); + Console.WriteLine("\t2- Espece"); + Console.WriteLine("\t3- Race"); + Console.WriteLine("\t4- Date de naissance"); + Console.WriteLine("\t5- Sexe"); + Console.WriteLine("\t6- Date d'adoption"); + Console.WriteLine("\t7- Taille"); + Console.WriteLine("\t8- Poids"); + Console.WriteLine("\t9- Alimentation"); + Console.WriteLine("\t10- Petsitter"); + Console.WriteLine("\t11- Chenil"); + Console.WriteLine("\t12- Vétérinaire"); + Console.WriteLine("\t13- Magasin alimentaire"); + Console.WriteLine("\t14- Refuge, élevage et chenil de provenance"); + Console.WriteLine("\t19- Retour"); + + Console.Write("\n\tEntrer votre choix : "); + int decision = Convert.ToInt32(Console.ReadLine()); + + switch (decision) + { + case 1: + ModifierNom(animal); + break; + case 2: + ModifierEspece(animal); + break; + case 3: + ModifierRace(animal); + break; + case 4: + ModifierDateNaissance(animal); + break; + case 5: + ModifierSexe(animal); + break; case 6: ModifierDateAdoption(animal); break; diff --git a/Sources/Model/Espece.cs b/Sources/Model/Espece.cs index f7bb060..4a8d5bd 100644 --- a/Sources/Model/Espece.cs +++ b/Sources/Model/Espece.cs @@ -14,43 +14,43 @@ namespace Model public class Espece { [DataMember(Name = "nom")] - public string Nom { get; } + public string Nom { get; set; } [DataMember(Name = "scientifique")] - public string NomScientifique { get; } + public string NomScientifique { get; set; } [DataMember(Name = "image")] - public string Image { get; } + public string Image { get; set; } [DataMember(Name = "esperance")] - public string EsperanceVie { get; } + public string EsperanceVie { get; set; } [DataMember(Name = "poids")] - public string PoidsMoyen { get; } + public string PoidsMoyen { get; set; } [DataMember(Name = "taille")] - public string TailleMoyenne { get; } + public string TailleMoyenne { get; set; } [DataMember(Name = "races")] - public List? ListeRaces { get; } = new List(); + public List? ListeRaces { get; set; } = new List(); [DataMember(Name = "comportement")] - public string Comportement { get; } + public string Comportement { get; set; } [DataMember(Name = "sante")] - public string Sante { get; } + public string Sante { get; set; } [DataMember(Name = "education")] - public string Education { get; } + public string Education { get; set; } [DataMember(Name = "entretien")] - public string Entretien { get; } + public string Entretien { get; set; } [DataMember(Name = "cout")] - public string Cout { get; } + public string Cout { get; set; } [DataMember(Name = "conseil")] - public string Conseil { get; } + public string Conseil { get; set; } public Espece(string nom = "", string nomScientifique = "", string image = "", string esperanceVie = "", string poidsMoyen = "", string tailleMoyenne = "", List? races = null, string comportement = "", string sante = "", string education = "", string entretien = "", string cout = "", string conseil = "") { diff --git a/Sources/Model/Race.cs b/Sources/Model/Race.cs index 29e5bed..4ed55c8 100644 --- a/Sources/Model/Race.cs +++ b/Sources/Model/Race.cs @@ -12,40 +12,40 @@ namespace Model public class Race { [DataMember(Name = "nom")] - public string Nom { get; } + public string Nom { get; set; } [DataMember(Name = "scientique")] - public string NomScientifique { get; } + public string NomScientifique { get; set; } [DataMember(Name = "esperance")] - public string EsperanceVie { get; } + public string EsperanceVie { get; set; } [DataMember(Name = "poids")] - public string PoidsMoyen { get; } + public string PoidsMoyen { get; set; } [DataMember(Name = "taille")] - public string TailleMoyenne { get; } + public string TailleMoyenne { get; set; } [DataMember(Name = "comportement")] - public string Comportement { get; } + public string Comportement { get; set; } [DataMember(Name = "sante")] - public string Sante { get; } + public string Sante { get; set; } [DataMember(Name = "education")] - public string Education { get; } + public string Education { get; set; } [DataMember(Name = "entretien")] - public string Entretien { get; } + public string Entretien { get; set; } [DataMember(Name = "cout")] - public string Cout { get; } + public string Cout { get; set; } [DataMember(Name = "conseil")] - public string Conseil { get; } + public string Conseil { get; set; } [DataMember(Name = "image")] - public string Image { get; } + public string Image { get; set; } public Race(string nom = "Inconnu", string nomScientifique = "Inconnu", string esperanceVie = "Inconnue", string poidsMoyen = "Inconnu", string tailleMoyenne = "Inconnu", string comportement = "Auncune information", string sante = "Aucune information", string education = "Auncune information", string entretien = "Aucune information", string cout = "Auncune information", string conseil = "Aucun conseil") { diff --git a/Sources/Model/Stub.cs b/Sources/Model/Stub.cs index fae9ce6..cbde0e3 100644 --- a/Sources/Model/Stub.cs +++ b/Sources/Model/Stub.cs @@ -36,5 +36,21 @@ namespace Model return listeAnimaux; } + + public static Theque LoadTheque() + { + Theque theque = new Theque(); + + List Races = new List(); + Races.Add(new("Abyssin")); + Races.Add(new("American curl")); + + theque.ListeEspeces.Add(new("Chien", "Canis lupus familiaris", "chien.jpg")); + theque.ListeEspeces.Add(new("Chat", "Felis catus", "chat.jpg", "15 à 20 ans", "15 à 20 kg", "10 à 15 cm", Races, "Les chats ont un comportement très solitaire", "Les chats ont une bonne santé", "Les chats s'éduque assez facilement", "Il faut changé leur caisse mais il se nettoie seul, sauf les chatons", "Vétérinaire, alimentation adapté, jouet", "Un conseil")); + theque.ListeEspeces.Add(new("Hamster", "Cricetinae")); + theque.ListeEspeces.Add(new("Lapin", "Oryctolagus cuniculus")); + + return theque; + } } } diff --git a/Sources/Model/Theque.cs b/Sources/Model/Theque.cs index 4a6cee4..5bce620 100644 --- a/Sources/Model/Theque.cs +++ b/Sources/Model/Theque.cs @@ -19,8 +19,8 @@ namespace Model public ObservableCollection ListeAnimaux { get; set; } public Theque() - { - ListeEspeces = Stub.LoadEspecetheque(); + { + ListeEspeces = new List(); ListeAnimaux = new ObservableCollection(); } diff --git a/Sources/Views/App.xaml.cs b/Sources/Views/App.xaml.cs index 91e6812..8eb3e18 100644 --- a/Sources/Views/App.xaml.cs +++ b/Sources/Views/App.xaml.cs @@ -6,7 +6,7 @@ namespace Views { public partial class App : Application, INotifyPropertyChanged { - public Theque Theque { get; set; } = new Theque(); + public Theque Theque { get; set; } = Stub.LoadTheque(); public Animal AnimalSelectionner { get; set; } public Espece EspeceSelectionner { get; set; } public Race RaceSelectionner { get; set; }