public async Task <ActionResult <Dcandidate> > PostDcandidate(Dcandidate dcandidate) { _context.dcandidates.Add(dcandidate); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDcandidate", new { id = dcandidate.Id }, dcandidate)); }
public async Task <IActionResult> PutDcandidate(int id, Dcandidate dcandidate) { //if (id != dcandidate.Id) //{ // return BadRequest(); //} dcandidate.Id = id; _context.Entry(dcandidate).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DcandidateExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }