Including a List<SpecificType> in a model, and how to populate it
- by Ray Sülzer
I currently have two Model classes:
class Leaders: List<Leaders>
{
public string LeaderName { get; set; }
public string PrecintName { get; set; }
}
public class MarketReport
{
//A list of activists
public Leaders leaderlist { get; set; }
}
Now, I have no idea if I am doing the above correctly, but I want to populate the list within the MarketReport
foreach (var store in stores)
{
MarketReport.leaderlist.AddItem //I want to add an item of type Leader to the list
//so that I can pass it to MVC view
}