I wasn't exactly sure what to title this question, this is the problem I'm trying to solve.
I have two tables with a many to many relationship between them, Fight and Fighter. A fighter can be in many fights, and a Fight has many fighters (2 fighters). These are mapped fine but what I want to do is have a column in the Fight table in which I can set who won the fight between the two fighters. What would be the best approach to this?
Thanks in advance, if you don't understand I'll try to explain it in a better way.
public class Fight
{
[Key]
public int FightId { get; set; }
[Key, ForeignKey("FightCard")]
public int CardId { get; set; }
public virtual ICollection<Fighter> Fighters { get; set; }
}
public class Fighter
{
[Key]
public int FighterID { get; set; }
[Required]
[DisplayName("First Name")]
public string FirstName { get; set; }
[Required]
[DisplayName("Last Name")]
public string LastName { get; set; }
[DisplayName("Nickname")]
public string NickName { get; set; }
[Required]
public string Nationality { get; set; }
public static String[] WeightClassOptions
{
get
{
return new String[] { "Heavyweight", "Light Heavyweight", "Middleweight", "Welterweight", "Lightweight", "Featherweight", "Bantamweight", "Flyweight" };
}
}
[DisplayName("Weight Class")]
public string WeightClass { get; set; }
public string Height { get; set; }
[Required]
[DisplayName("Date of Birth")]
[DataType(DataType.Date)]
public DateTime DateOfBirth { get; set; }
// Fight Record:
public int Wins { get; set; }
public int Loss { get; set; }
public int Draw { get; set; }
public int NoContest { get; set; }
public String Picture { get; set; }
public virtual ICollection<Fight> Fight { get; set; }