示例#1
0
 public static List <SimpleListItem> GetPreviewCandidateItems(string electionKey,
                                                              string officeKey)
 {
     return(new List <SimpleListItem> {
         new SimpleListItem(Empty, "<none>")
     }.Union(
                ElectionsPoliticians.GetPoliticiansForOfficeInElection(electionKey, officeKey).Rows
                .Cast <DataRow>().Select(row =>
                                         new SimpleListItem(row.PoliticianKey(), Politicians.FormatName(row)))).ToList());
 }
 public List <VoteUsaCandidate> GetVoteUsaCandidates(string electionKey,
                                                     string officeKey) =>
 ElectionsPoliticians
 .GetPoliticiansForOfficeInElection(electionKey, officeKey)
 .Rows.Cast <DataRow>()
 .Select(
     row =>
     new VoteUsaCandidate
 {
     Value      = row.PoliticianKey(),
     Text       = Politicians.FormatName(row),
     FirstThree = row.LastName().Substring(0,
                                           Math.Min(3, row.LastName().Length)).ToLowerInvariant()
 })
 .ToList();