Пример #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 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));
 }
Пример #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);
        }
Пример #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);
 }
Пример #6
0
 public void EditRallies(RalliesViewModel irally)
 {
     dataGatewayRallies.Update(irally);
     dataGatewayRallies.Save();
 }