Beispiel #1
0
        private bool IsFirstVoteFromVoter(Vote vote)
        {
            var hasVoterAlreadyVoted = this.blockchain.TryGetVoteByVoter(vote.VoterId, out var dummyVote);

            return(!hasVoterAlreadyVoted);
        }
Beispiel #2
0
        public bool IsValid(Vote vote)
        {
            var isPastTimeLimit = DateTime.Now > this.electionEndTime;

            return(!isPastTimeLimit && this.IsValidVoter(vote) && this.IsFirstVoteFromVoter(vote) && IsSignatureValid(vote));
        }
Beispiel #3
0
        private bool IsValidVoter(Vote vote)
        {
            var isValidVoter = this.voterDb.DoesVoterExist(vote.VoterId);

            return(isValidVoter);
        }
Beispiel #4
0
 public bool IsValid(Vote vote)
 {
     return(this.IsValidVoter(vote) && this.IsFirstVoteFromVoter(vote) && IsSignatureValid(vote));
 }