예제 #1
0
 public IEnumerable <Candidate> GetPendingCandidates()
 {
     using (var context = new CTContext(_conn))
     {
         return(context.Candidates.Where(c => c.Status == 0).ToList());
     }
 }
예제 #2
0
 public int GetDeclinedAmount()
 {
     using (var context = new CTContext(_conn))
     {
         return(GetDeclinedCandidates().Count());
     }
 }
예제 #3
0
 public int GetPendingAmount()
 {
     using (var context = new CTContext(_conn))
     {
         return(GetPendingCandidates().Count());
     }
 }
예제 #4
0
 public Candidate GetCandidateById(int id)
 {
     using (var context = new CTContext(_conn))
     {
         return(context.Candidates.FirstOrDefault(c => c.Id == id));
     }
 }
예제 #5
0
 public void DeclineCandidate(int id)
 {
     using (var context = new CTContext(_conn))
     {
         var candidate = context.Candidates.FirstOrDefault(c => c.Id == id);
         candidate.Status = 2;
         context.Candidates.Update(candidate);
         context.SaveChanges();
     }
 }
예제 #6
0
 public void AddCandidate(Candidate c)
 {
     using (var context = new CTContext(_conn))
     {
         var candidate = new Candidate
         {
             Name   = c.Name,
             Email  = c.Email,
             Number = c.Number,
             Notes  = c.Notes,
             Status = 0
         };
         context.Candidates.Add(candidate);
         context.SaveChanges();
     }
 }