Including a List<SpecificType> in a model, and how to populate it

Posted by Ray Sülzer on Stack Overflow See other posts from Stack Overflow or by Ray Sülzer
Published on 2012-11-02T22:52:27Z Indexed on 2012/11/02 23:00 UTC
Read the original article Hit count: 175

Filed under:
|

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                           
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc