public async Task <ActionResult <ECandidate> > PostECandidate(ECandidate eCandidate) { _context.ECandidates.Add(eCandidate); await _context.SaveChangesAsync(); return(CreatedAtAction("GetECandidate", new { id = eCandidate.Id }, eCandidate)); }
public async Task <IActionResult> PutECandidate(int id, ECandidate eCandidate) { if (id != eCandidate.Id) { return(BadRequest()); } _context.Entry(eCandidate).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ECandidateExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }