You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
2.6 KiB
88 lines
2.6 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.Serialization;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Modèle
|
|
{
|
|
[DataContract]
|
|
public class Requin : IEquatable<Requin>
|
|
{
|
|
[DataMember]
|
|
public string Nom { get; private set; }
|
|
[DataMember]
|
|
public string NomSci { get; private set; }
|
|
[DataMember]
|
|
public string Description { get; private set; }
|
|
[DataMember]
|
|
public string Photo { get; private set; }
|
|
[DataMember]
|
|
public string Video { get; private set; }
|
|
[DataMember]
|
|
public string PhotoCarte { get; private set; }
|
|
[DataMember]
|
|
public Conservation StatutCons { get; private set; }
|
|
[DataMember]
|
|
public string FunFact { get; private set; }
|
|
[DataMember]
|
|
public List<Zone> Repartition { get; private set; }
|
|
|
|
|
|
public Requin(string nom, string nomSci, string description, string photo, string video, string photoCarte, Conservation statutCons, List<Zone> repartition, string funFact) {
|
|
Nom = nom;
|
|
NomSci = nomSci;
|
|
Description = description;
|
|
Photo = photo;
|
|
Video = video;
|
|
PhotoCarte = photoCarte;
|
|
StatutCons = statutCons;
|
|
Repartition = repartition;
|
|
FunFact = funFact;
|
|
}
|
|
|
|
public Requin(string nom, string nomSci, string description, string photo, string video, string photoCarte, Conservation statutCons, List<Zone> repartition, List<string> funFacts)
|
|
{
|
|
Random rnd = new Random();
|
|
int num = rnd.Next(funFacts.Count());
|
|
Nom = nom;
|
|
NomSci = nomSci;
|
|
Description = description;
|
|
Photo = photo;
|
|
Video = video;
|
|
PhotoCarte = photoCarte;
|
|
StatutCons = statutCons;
|
|
Repartition = repartition;
|
|
FunFact = funFacts[num];
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Nom + " " + NomSci + " " + Description + " " + StatutCons + " " + FunFact + " " + Photo;
|
|
}
|
|
|
|
|
|
|
|
public bool Equals(Requin r)
|
|
{
|
|
return r.Nom == Nom && r.NomSci == NomSci;
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (ReferenceEquals(obj, null)) return false;
|
|
if (ReferenceEquals(obj, this)) return true;
|
|
if (GetType() != obj.GetType()) return false;
|
|
return Equals(obj as Requin);
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return Nom.GetHashCode() ^ NomSci.GetHashCode();
|
|
}
|
|
|
|
|
|
}
|
|
}
|