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.ComponentModel;
using System.Runtime.CompilerServices;
using System.Net.Http.Headers;
using System.Runtime.Serialization;
namespace Model
{
[DataContract(Name = "carte")]
public class Carte : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
@ -17,8 +20,11 @@ namespace Model
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
[DataMember]
private readonly string nom;
[DataMember]
public string Nom => nom;
[DataMember]
public string Description {
get => description;
set {
@ -27,6 +33,7 @@ namespace Model
}
}
private string description;
[DataMember]
public string Pouvoir {
get => pouvoir;
set
@ -36,6 +43,7 @@ namespace Model
}
}
private string pouvoir;
[DataMember]
public string Strategie
{
get => strategie;
@ -46,7 +54,7 @@ namespace Model
}
}
private string strategie;
private int? note;
[DataMember]
public int? Note
{
get
@ -63,6 +71,8 @@ namespace Model
OnPropertyChanged(nameof(Note));
}
}
private int? note;
[DataMember]
public string LienImage
{
get => lienImage;
@ -83,5 +93,21 @@ namespace Model
this.note = note;
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