I'm trying to learn ASP .NET by creating a sample website, and have a problem. Suppose I have the following classes:
public class Player
{
public string name {get; set;}
public int age {get; set;}
public double salary {get; set;}
public string gender {get; set;}
public DateTime contractSignDate {get; set;}
}
public class Team
{
public string teamName {get; set;}
public string sportPlayed {get; set;}
public List<Player> players {get; set;}
}
Now if I try to use Scaffolding in VS2013 to create controller and CRUD pages around the Model Team, but the pages will only have fields for teamName
and sportPlayed
. players
List control will not be catered for. Ideally speaking, when I'm creating a new team, I'd like a way to define new Players and add them to that team as well. This can be either through Player addition controls on the Team Create page, or maybe a button such as 'Manage Players' which when clicked, opens a small popup where Players can be added. How can this be achieved while using Scaffolding ?
You could fix it by using a partial view where you can use scaffolding(Create template) to create a new player.