示例#1
0
        // allow the Candidate to vote for the Candidate through the CandidateID
        public void Vote(int candidateID, int currentUserID)
        {
            // capture currentCandidate, set HasVoted to true and save it to DB
            CandidateViewModel currentUser = dataGatewayCandidate.SelectByID(currentUserID);

            currentUser.HasVoted = true;
            dataGatewayCandidate.Update(currentUser);

            currentCandidate.hasVoted = true;   // save it in runtime class

            // capture Candidate to be voted, increment TotalVotes and save it to DB
            CandidateViewModel candidate = dataGatewayCandidate.SelectByID(candidateID);

            candidate.TotalVotes++;
            dataGatewayCandidate.Update(candidate);
        }
示例#2
0
 public RalliesViewModel ViewRallies(int id)
 {
     return(dataGatewayRallies.SelectByID(id));
 }
 public CandidateProfileViewModel ViewProfile(int id)
 {
     return(dataGatewayCandidateProfile.SelectByID(id));
 }
 public CampaignDateViewModel getCampaignViewModel()
 {
     return(dataGatewayCampaign.SelectByID(campaignID));
 }