コード例 #1
0
 public void AddCandidate(Candidate candidate)
 {
     using (var cxt = new CandidateContext(_connectionString))
     {
         cxt.Candidates.Add(candidate);
         cxt.SaveChanges();
     }
 }
コード例 #2
0
 public void ChangeCandidateStatus(Candidate candidate)
 {
     using (var cxt = new CandidateContext(_connectionString))
     {
         cxt.Candidates.Attach(candidate);
         cxt.Entry(candidate).State = EntityState.Modified;
         cxt.SaveChanges();
     }
 }