public void UpdateStatus(int id, Status status)
 {
     using (var context = new Applicants_DataDataContext(_connectionstring))
     {
         context.ExecuteCommand("UPDATE Applicants SET Status = {0} WHERE Id = {1}", status, id);
     }
 }
 public IEnumerable <Applicant> GetApplicants(Status status)
 {
     using (var context = new Applicants_DataDataContext(_connectionstring))
     {
         return(context.Applicants.Where(a => a.Status == status).ToList());
     }
 }
 public Applicant GetApplicant(int id)
 {
     using (var context = new Applicants_DataDataContext(_connectionstring))
     {
         return(context.Applicants.FirstOrDefault(a => a.Id == id));
     }
 }
 public void Add(Applicant applicant)
 {
     using (var context = new Applicants_DataDataContext(_connectionstring))
     {
         context.Applicants.InsertOnSubmit(applicant);
         context.SubmitChanges();
     }
 }
 public ApplicantCounts GetCounts()
 {
     using (var context = new Applicants_DataDataContext(_connectionstring))
     {
         return(new ApplicantCounts
         {
             Confirmed = context.Applicants.Count(a => a.Status == Status.Confirmed),
             Pending = context.Applicants.Count(a => a.Status == Status.Pending),
             Refused = context.Applicants.Count(a => a.Status == Status.Refused)
         });
     }
 }