Пример #1
0
 public void ChangeStatus(int candidateId, CandidateStatus status)
 {
     using (var context = new CandidateTrackerDBDataContext(_connectionString))
     {
         context.ExecuteCommand("UPDATE Candidates SET Status = {0} WHERE Id = {1}", status, candidateId);
     }
 }
Пример #2
0
 public IEnumerable <Candidate> GetCandidates(CandidateStatus status)
 {
     using (var context = new CandidateTrackerDBDataContext(_connectionString))
     {
         return(context.Candidates.Where(c => c.Status == (int)status).ToList());
     }
 }
Пример #3
0
 public Candidate GetCandidate(int id)
 {
     using (var context = new CandidateTrackerDBDataContext(_connectionString))
     {
         return(context.Candidates.FirstOrDefault(c => c.Id == id));
     }
 }
Пример #4
0
 public int GetCount(CandidateStatus status)
 {
     using (var context = new CandidateTrackerDBDataContext(_connectionString))
     {
         int result = context.Candidates.Where(c => c.Status == (int)status).Count();
         return(result);
     }
 }
Пример #5
0
 public void AddCandidate(Candidate c)
 {
     using (var context = new CandidateTrackerDBDataContext(_connectionString))
     {
         c.Status = (int)CandidateStatus.Pending;
         context.Candidates.InsertOnSubmit(c);
         context.SubmitChanges();
     }
 }