Ejemplo n.º 1
0
        private List <string> ListVoterNames(OptionWithVotesModel option)
        {
            List <string> output = new List <string>();

            foreach (var vote in option.Votes)
            {
                output.Add(vote.VoterName);
            }

            return(output);
        }
Ejemplo n.º 2
0
        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);
        }