DataContractSerializer
continuous-integration/drone/push Build is passing Details

Persistance
Loris OBRY 2 years ago
parent 7f1640b329
commit 00f030887b

@ -6,9 +6,12 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Net.Http.Headers;
using System.Runtime.Serialization;
namespace Model namespace Model
{ {
[DataContract(Name = "carte")]
public class Carte : INotifyPropertyChanged public class Carte : INotifyPropertyChanged
{ {
public event PropertyChangedEventHandler? PropertyChanged; public event PropertyChangedEventHandler? PropertyChanged;
@ -17,8 +20,11 @@ namespace Model
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
[DataMember]
private readonly string nom; private readonly string nom;
[DataMember]
public string Nom => nom; public string Nom => nom;
[DataMember]
public string Description { public string Description {
get => description; get => description;
set { set {
@ -27,6 +33,7 @@ namespace Model
} }
} }
private string description; private string description;
[DataMember]
public string Pouvoir { public string Pouvoir {
get => pouvoir; get => pouvoir;
set set
@ -36,6 +43,7 @@ namespace Model
} }
} }
private string pouvoir; private string pouvoir;
[DataMember]
public string Strategie public string Strategie
{ {
get => strategie; get => strategie;
@ -46,7 +54,7 @@ namespace Model
} }
} }
private string strategie; private string strategie;
private int? note; [DataMember]
public int? Note public int? Note
{ {
get get
@ -63,6 +71,8 @@ namespace Model
OnPropertyChanged(nameof(Note)); OnPropertyChanged(nameof(Note));
} }
} }
private int? note;
[DataMember]
public string LienImage public string LienImage
{ {
get => lienImage; get => lienImage;
@ -83,5 +93,21 @@ namespace Model
this.note = note; this.note = note;
this.lienImage = LienImage; this.lienImage = LienImage;
} }
public override int GetHashCode()
=> Nom.GetHashCode();
public override bool Equals(object right)
{
if (object.ReferenceEquals(right, null)) return false;
if (object.ReferenceEquals(right, this)) return true;
if (this.GetType() != right.GetType()) return false;
return this.Equals(right);
}
public bool Equals(Carte other)
{
return (this.nom == other.nom);
}
} }
} }

Loading…
Cancel
Save