public int GetConfirmedCount() { using (var ctx = new CTContext(_connectionString)) { return(ctx.Candidates.Count(c => c.Confirmed == true)); } }
public IEnumerable <Candidate> GetDeclined() { using (var ctx = new CTContext(_connectionString)) { return(ctx.Candidates.Where(c => c.Declined == true).ToList()); } }
public Candidate GetCandidate(int id) { using (var ctx = new CTContext(_connectionString)) { return(ctx.Candidates.FirstOrDefault(c => c.Id == id)); } }
public void AddCandidate(Candidate candidate) { using (var ctx = new CTContext(_connectionString)) { ctx.Add(candidate); ctx.SaveChanges(); } }
public void UpdateToDeclined(int id) { using (var ctx = new CTContext(_connectionString)) { ctx.Database.ExecuteSqlCommand( "UPDATE Candidates SET Declined = 'True', Pending = 'False' WHERE Id = @id", new SqlParameter("@id", id)); } }