Beispiel #1
0
 public Candidate GetCandidateById(int id)
 {
     using (var context = new CandidateContext(_connection))
     {
         return(context.Candidates.FirstOrDefault(c => c.Id == id));
     }
 }
Beispiel #2
0
 public List <Candidate> GetCandidates()
 {
     using (var context = new CandidateContext(_connection))
     {
         return(context.Candidates.ToList());
     }
 }
Beispiel #3
0
 public List <Candidate> GetCandidatesByStatus(string status)
 {
     using (var context = new CandidateContext(_connection))
     {
         return(context.Candidates.Where(c => c.Status == status).ToList());
     }
 }
Beispiel #4
0
 public void AddCandidate(Candidate c)
 {
     using (var context = new CandidateContext(_connection))
     {
         context.Candidates.Add(c);
         context.SaveChanges();
     }
 }
Beispiel #5
0
 public void UpdateCandidate(Candidate c)
 {
     using (var context = new CandidateContext(_connection))
     {
         context.Candidates.Attach(c);
         context.Entry(c).State = EntityState.Modified;
         context.SaveChanges();
     }
 }