From 18f1fd95d2e6d1c5289b881eb3ce37f962f180fc Mon Sep 17 00:00:00 2001 From: Loris OBRY Date: Wed, 31 May 2023 15:20:27 +0200 Subject: [PATCH] Commentaire et Icontenu --- Sources/ConsoleApp/FileName.cs | 1 + Sources/Model/Carte.cs | 7 +++---- Sources/Model/Commentaire.cs | 20 ++++++++++++++++++++ Sources/Model/IContenu.cs | 15 +++++++++++++++ 4 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 Sources/Model/Commentaire.cs create mode 100644 Sources/Model/IContenu.cs diff --git a/Sources/ConsoleApp/FileName.cs b/Sources/ConsoleApp/FileName.cs index 3ab4062..26e9d95 100644 --- a/Sources/ConsoleApp/FileName.cs +++ b/Sources/ConsoleApp/FileName.cs @@ -25,6 +25,7 @@ namespace ConsoleApp */ Carte C = new Carte("Villageois", "Aucuns", "Doit voter inteligemment", null, "lien", "une carte peu apprécié mais necesaire"); + Console.WriteLine(C.Nom); } static void DisplayTab(string name, int[] tab) diff --git a/Sources/Model/Carte.cs b/Sources/Model/Carte.cs index 9479b48..d9d5027 100644 --- a/Sources/Model/Carte.cs +++ b/Sources/Model/Carte.cs @@ -9,7 +9,7 @@ using System.Runtime.CompilerServices; namespace Model { - public class Carte : INotifyPropertyChanged + public class Carte : IContenu, INotifyPropertyChanged { public event PropertyChangedEventHandler? PropertyChanged; void OnPropertyChanged([CallerMemberName] string ?propertyName = null) @@ -17,8 +17,7 @@ namespace Model PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } - private readonly string nom; - public string Nom => nom; + public string Nom { get; set; } public string Description { get => description; set { @@ -76,7 +75,7 @@ namespace Model private string lienImage; public Carte(string nom, string pouvoir, string strategie, int? note, string lienImage, string description) { - this.nom = nom; + this.Nom = nom; this.description = description; this.pouvoir = pouvoir; this.strategie = strategie; diff --git a/Sources/Model/Commentaire.cs b/Sources/Model/Commentaire.cs new file mode 100644 index 0000000..f658a66 --- /dev/null +++ b/Sources/Model/Commentaire.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + internal class Commentaire + { + public string texte { get; set; } + public Utilisateur Proprietaire { get; set; } + public IContenu Contenu { get; set; } + Commentaire(string contenu, Utilisateur Proprietaire) + { + this.Contenu = Contenu; + this.Proprietaire = Proprietaire; + } + } +} diff --git a/Sources/Model/IContenu.cs b/Sources/Model/IContenu.cs new file mode 100644 index 0000000..ea577fd --- /dev/null +++ b/Sources/Model/IContenu.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public interface IContenu + { + public string Nom { get; set; } + public string Description { get; set; } + public int? Note { get; set; } + } +}