Ejemplo n.º 1
0
 public Candidate GetCandidate(int id)
 {
     using (var context = new CandidateContext(_connectionString))
     {
         return(context.Candidates.FirstOrDefault(x => x.Id == id));
     }
 }
Ejemplo n.º 2
0
 public List <Candidate> GetAll()
 {
     using (var context = new CandidateContext(_connectionString))
     {
         return(context.Candidates.ToList());
     }
 }
Ejemplo n.º 3
0
 public void RefuseCandidate(int id)
 {
     using (var context = new CandidateContext(_connectionString))
     {
         context.Database.ExecuteSqlCommand("UPDATE Candidates SET Pending = 0, Refused = 1 WHERE Id = @id",
                                            new SqlParameter("@id", id));
     }
 }
Ejemplo n.º 4
0
 public void Add(Candidate c)
 {
     using (var context = new CandidateContext(_connectionString))
     {
         context.Candidates.Add(c);
         context.SaveChanges();
     }
 }