public void PutCandidate(Candidate candidate) { if (candidate != null && ModelState.IsValid) { if (candidate.CandidateId != 0) { db1.Update(candidate); db1.Save(); } } }