예제 #1
0
 public async Task <Models.Database.VoteCandidate> UpdateCandidate(Models.Database.VoteCandidate voteCandidate)
 {
     using (var context = new toafcContext())
     {
         context.VoteCandidates.Update(voteCandidate);
         await context.SaveChangesAsync();
     }
     return(voteCandidate);
 }
예제 #2
0
        public async Task <Models.Database.VoteCandidate> UpdateCandidate(Models.Database.VoteCandidate candidate)
        {
            Exceptions.TestForNull(candidate, nameof(candidate));
            candidate = await voteCandidateDB.UpdateCandidate(candidate);

            var cacheKey = "VoteCandidates";

            _cacheOperation.Delete(cacheKey);
            return(candidate);
        }
예제 #3
0
 public async Task <IActionResult> UpdateCandidate([FromBody] Models.Database.VoteCandidate candidate)
 {
     try
     {
         return(Json(await voteCandidate.UpdateCandidate(candidate)));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e));
     }
 }