Exemplo n.º 1
0
        public static VotingCardDto ToVotingCardDto(VotingCard votingCard)
        {
            var votingCardDto = new VotingCardDto()
            {
                Id                 = votingCard.Id,
                IsInvalid          = votingCard.IsInvalid,
                AmtAlreadyVoted    = votingCard.AmtAlreadyVoted,
                IsVoted            = votingCard.IsVoted,
                NumberOfCandidates = votingCard.NumberOfCandidates,
                ShareHolderId      = votingCard.ShareHolderId,
                NumberOfShares     = votingCard.NumberOfShares,
                VotingCardType     = votingCard.VotingCardType,
                VotingCardLines    = new List <VotingCardLineDto>()
            };

            foreach (var item in votingCard.VotingCardLines)
            {
                var lineDto = new VotingCardLineDto()
                {
                    Id            = item.Id,
                    CandidateId   = item.CandidateId,
                    CandidateName = item.CandidateName,
                    VotingAmt     = item.VotingAmt,
                    VotingCardId  = item.VotingCardId
                };
                votingCardDto.VotingCardLines.Add(lineDto);
            }

            return(votingCardDto);
        }
Exemplo n.º 2
0
        public void AddVotingCard(VotingCard votingCard)
        {
            if (votingCard == null)
            {
                throw new ArgumentNullException();
            }

            VotingCards.Add(votingCard);
        }