Exemplo n.º 1
0
 public int GetCandidateCountByStatus(Status status)
 {
     using (var context = new CandidatesDataContext(_connectionString))
     {
         return(context.Candidates.Count(c => c.Status == status));
     }
 }
Exemplo n.º 2
0
 public Candidate GetById(int id)
 {
     using (var context = new CandidatesDataContext(_connectionString))
     {
         return(context.Candidates.FirstOrDefault(i => i.Id == id));
     }
 }
Exemplo n.º 3
0
 public IEnumerable <Candidate> GetCandidatesByStatus(Status status)
 {
     using (var context = new CandidatesDataContext(_connectionString))
     {
         return(context.Candidates.Where(c => c.Status == status).ToList());
     }
 }
Exemplo n.º 4
0
 public IEnumerable <Candidate> GetCandidates()
 {
     using (var context = new CandidatesDataContext(_connectionString))
     {
         return(context.Candidates.ToList());
     }
 }
Exemplo n.º 5
0
 public void SetStatus(int id, Status status)
 {
     using (var context = new CandidatesDataContext(_connectionString))
     {
         context.ExecuteCommand("UPDATE Candidates SET Status = {1}  WHERE Id = {0}", id, status);
     }
 }
Exemplo n.º 6
0
 public void AddCandidate(Candidate candidate)
 {
     using (var context = new CandidatesDataContext(_connectionString))
     {
         context.Candidates.InsertOnSubmit(candidate);
         context.SubmitChanges();
     }
 }