using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; namespace Model.Classes { [DataContract(Name = "fruitdudemon")] public class FruitDuDemon : ObjetOhara { [DataMember(Name = "nomromanise")] public string NomRomanise { get; set; } [DataMember(Name = "type")] public string Type { get; set; } [DataMember(Name = "premierchap")] public int PremierChap { get; set; } [DataMember(Name = "premierep")] public int PremierEp { get; set; } [DataMember(Name = "description")] public string Description { get; set; } [DataMember(Name = "forces")] public string Forces { get; set; } [DataMember(Name = "faiblesses")] public string Faiblesses { get; set; } [DataMember(Name = "utilisateur", EmitDefaultValue = false)] public List Utilisateur { get; set; } = new List(); public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses) : base(nom) { NomRomanise = nomRomanise; Type = type; if (premierEp < 0) { PremierEp = 0; } else { PremierEp = premierEp; } if (premierChap < 0) { premierChap = 0; } else { PremierChap = premierChap; } Description = description; Forces = forces; Faiblesses = faiblesses; } public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses, string image) : this(nom, nomRomanise, type, premierChap, premierEp, description, forces, faiblesses) { Image = image; } public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses, string image, List utilisateur) : this(nom, nomRomanise, type, premierChap, premierEp, description, forces, faiblesses, image) { Utilisateur = utilisateur; } public override bool Equals(object? obj) { if (obj == null) return false; if (this.GetType() != obj.GetType()) { return false; } else { FruitDuDemon o = (FruitDuDemon)obj; return o.Nom == Nom; } } public override int GetHashCode() { return HashCode.Combine(NomRomanise, Type, PremierChap, PremierEp, Description, Forces, Faiblesses); } public override string ToString() { return "FruitDuDemon :" + Nom +" " +EstFavori+" " + NomRomanise + " " + Type + " " + PremierChap + " " + PremierEp + " " + Description + " " + Forces +" "+Faiblesses+ " " + Image; } } }