private List <string> ListVoterNames(OptionWithVotesModel option) { List <string> output = new List <string>(); foreach (var vote in option.Votes) { output.Add(vote.VoterName); } return(output); }
private async Task <PollVotingResultModel> AddOptionsAndVotesToModel(PollVotingResultModel pollResults, List <PollOptionModel> tempOptions) { foreach (var item in tempOptions) { OptionWithVotesModel optionWithVotes = new OptionWithVotesModel() { Option = item }; var tempVotes = await _voteRepo.GetVotesByOptionId(item.Id); if (tempVotes != null) { optionWithVotes.Votes = tempVotes; } pollResults.Options.Add(optionWithVotes); } return(pollResults); }