Exemple #1
0
 public int AddCandidate(Candidates candidate)
 {
     using (var context = new CandidateContext(_connectionString))
     {
         context.Candidates.Add(candidate);
         context.SaveChanges();
         return(candidate.Id);
     }
 }
Exemple #2
0
 public void Update(int candidateId, Status status)
 {
     using (var context = new CandidateContext(_connectionString))
     {
         Candidates c = context.Candidates.FirstOrDefault(ca => ca.Id == candidateId);
         c.Status = status;
         context.Candidates.Attach(c);
         context.Entry(c).State = EntityState.Modified;
         context.SaveChanges();
     }
 }