Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "reviewID,itemID,reviewerID,reviewerName,reviewDate,reviewDescription,reviewRating")] Review review)
 {
     if (ModelState.IsValid)
     {
         dataGateway.Update(review);
         return(RedirectToAction("Index", new { itemID = review.itemID, itemName = Session["itemName"] }));
     }
     TempData["reviewItemID"] = review.reviewID;
     return(View(review));
 }
Exemplo n.º 3
0
        public void Execute(string id)
        {
            var item = _dataGateway.Get(id);

            if (item == null)
            {
                throw new BusinessException($"Item with id '{id}' does not exist.");
            }

            item.Undo();

            _dataGateway.Update(item);
        }
Exemplo n.º 4
0
 // Save dates to DB
 public bool saveDates(DateTime startDate, DateTime endDate)
 {
     if (validateDates(startDate, endDate))
     {
         CampaignDateViewModel campaign = dataGatewayCampaign.SelectByID(campaignID);
         campaign.StartDate = startDate;
         campaign.EndDate   = endDate;
         dataGatewayCampaign.Update(campaign);
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public void EditProfile(CandidateProfileViewModel cd)
 {
     dataGatewayCandidateProfile.Update(cd);
 }
Exemplo n.º 6
0
 public void EditRallies(RalliesViewModel irally)
 {
     dataGatewayRallies.Update(irally);
     dataGatewayRallies.Save();
 }