public void Update(Candidate candidate)
 {
     using var context = new CandidateDbContext(_connectionString);
     context.Candidates.Attach(candidate);
     context.Entry(candidate).State = EntityState.Modified;
     context.SaveChanges();
 }
        public async Task <ActionResult> PutCandidate(int id, Candidate candidate)
        {
            // if (id != candidate.id) return BadRequest();
            candidate.id = id;

            _context.Entry(candidate).State = EntityState.Modified;
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
                // if (!Candi)
            }

            return(NoContent());
        }