public async Task <ActionResult <CCandidate> > PostCCandidate(CCandidate cCandidate) { _context.CCandidates.Add(cCandidate); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCCandidate", new { id = cCandidate.id }, cCandidate)); }
public async Task <IActionResult> PutCCandidate(int id, CCandidate cCandidate) { cCandidate.id = id; _context.Entry(cCandidate).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CCandidateExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }