I'm trying to make a page were you can see all the F1 drivers with there stats and there characteristics. With that last one I'm having some trouble...
Pilot.cs
public class Pilot
{
public string SurName { get; set; }
public string FirstName { get; set; }
public TeamNames TeamName { get; set; }
public string Image { get; set; }
public int Podiums { get; set; }
public int Championships { get; set; }
public int GrandsPrix { get; set; }
public int Points { get; set; }
public Characteristic Characteristics { get; set; }
}
PilotRepository.cs
public class PilotRepository
{
protected static Pilot[] Pilots =
{
new Pilot
{
SurName = "Hamilton",
FirstName = "Lewis",
TeamName = TeamNames.Mercedes,
Image = "hamilton.jpg",
Podiums = 151,
Championships = 6,
GrandsPrix = 250,
Points = 3431,
Characteristics = Characteristic.WorldClass | Characteristic.Consistency | Characteristic.Veteran
},
new Pilot
{
SurName = "Bottas",
FirstName = "Valtteri",
TeamName = TeamNames.Mercedes,
Image = "bottas.jpg",
Podiums = 45,
Championships = 0,
GrandsPrix = 140,
Points = 1289,
Characteristics = Characteristic.WorldClass | Characteristic.Consistency | Characteristic.Veteran
}
};
public IEnumerable<Pilot> GetPilots()
{
return Pilots;
}
}
Characteristic.cs
[Flags]
public enum Characteristic
{
[Display(Name = "World Class")]
WorldClass,
[Display(Name = "Future star")]
FutureStar,
[Display(Name = "Agressive driver")]
AgressiveDriver,
Consistency,
[Display(Name = "Crash master")]
CrashMaster,
Modest,
Veteran,
[Display(Name = "Epic battles")]
EpicBattles,
[Display(Name = "Early retirements")]
EarlyRetirements,
Overtaker,
Rookie,
[Display(Name = "Last of the pack")]
LastOfThePack
}
Now when I show them in my views I only get the first and last one. Or in some cases I get totally different ones than the ones that I gave in. Anyone know what I'm missing here?