I am creating a softball schedule app that will be used by multiple teams.
I have a table the has team info - id, name, coach, etc
I have a table that has game info - id, date, teamid, opponentid, outcome
Here are the two models:
I know how to use LINQ to pass a model into my view that can return a list of games for a particular team, but of course it shows an ID number for the two teams involved and not the team names. How can I make it show the team names without resorting to doing data calls in the View itself?
I have a table the has team info - id, name, coach, etc
I have a table that has game info - id, date, teamid, opponentid, outcome
Here are the two models:
Code:
namespace softball.Models
{
[Table("tblTeams")]
public class Team
{
[Key]
public int iTeamID { get; set; }
public string sTeamName { get; set; }
public string sCoach { get; set; }
}
}
Code:
namespace softball.Models
{
[Table("tblSBgames")]
public class Game
{
[Key]
public int iGameID { get; set; }
public int iTeamID { get; set; }
public DateTime dtDate { get; set; }
public int iOpponentID { get; set; }
public byte? tiOutcome { get; set; }
}
}
I know how to use LINQ to pass a model into my view that can return a list of games for a particular team, but of course it shows an ID number for the two teams involved and not the team names. How can I make it show the team names without resorting to doing data calls in the View itself?