public void AddCandidate(Candidate candidate) { using (var cxt = new CandidateContext(_connectionString)) { cxt.Candidates.Add(candidate); cxt.SaveChanges(); } }
public void ChangeCandidateStatus(Candidate candidate) { using (var cxt = new CandidateContext(_connectionString)) { cxt.Candidates.Attach(candidate); cxt.Entry(candidate).State = EntityState.Modified; cxt.SaveChanges(); } }