Ejemplo n.º 1
0
 public void Refuse(int candidateId)
 {
     using (var context = new CandidateDataContext(_connectionString))
     {
         context.ExecuteCommand("UPDATE Candidates SET Status = 2 WHERE Id={0}", candidateId);
     }
 }
Ejemplo n.º 2
0
 public int GetNumPending()
 {
     using (var context = new CandidateDataContext(_connectionString))
     {
         return(context.Candidates.ToList().Where(c => c.Status == 0).Count());
     }
 }
Ejemplo n.º 3
0
 public Candidate GetCandidateById(int id)
 {
     using (var context = new CandidateDataContext(_connectionString))
     {
         return(context.Candidates.ToList().FirstOrDefault(c => c.Id == id));
     }
 }
Ejemplo n.º 4
0
 public IEnumerable <Candidate> GetRefusedCandidates()
 {
     using (var context = new CandidateDataContext(_connectionString))
     {
         return(context.Candidates.ToList().Where(c => c.Status == Status.Refused));
     }
 }
Ejemplo n.º 5
0
 public void AddCandidate(Candidate c)
 {
     using (var context = new CandidateDataContext(_connectionString))
     {
         context.Candidates.InsertOnSubmit(c);
         context.SubmitChanges();
     }
 }
Ejemplo n.º 6
0
 public StatusCounts GetCounts()
 {
     using (var context = new CandidateDataContext(_connectionString))
     {
         var counts = new StatusCounts
         {
             Pending   = context.Candidates.ToList().Where(c => c.Status == Status.Pending).Count(),
             Refused   = context.Candidates.ToList().Where(c => c.Status == Status.Refused).Count(),
             Confirmed = context.Candidates.ToList().Where(c => c.Status == Status.Confirmed).Count(),
         };
         return(counts);
     }
 }