public int GetCandidateCountByStatus(Status status) { using (var context = new CandidatesDataContext(_connectionString)) { return(context.Candidates.Count(c => c.Status == status)); } }
public Candidate GetById(int id) { using (var context = new CandidatesDataContext(_connectionString)) { return(context.Candidates.FirstOrDefault(i => i.Id == id)); } }
public IEnumerable <Candidate> GetCandidatesByStatus(Status status) { using (var context = new CandidatesDataContext(_connectionString)) { return(context.Candidates.Where(c => c.Status == status).ToList()); } }
public IEnumerable <Candidate> GetCandidates() { using (var context = new CandidatesDataContext(_connectionString)) { return(context.Candidates.ToList()); } }
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); } }
public void AddCandidate(Candidate candidate) { using (var context = new CandidatesDataContext(_connectionString)) { context.Candidates.InsertOnSubmit(candidate); context.SubmitChanges(); } }