public async Task <ActionResult <DCandidates> > PostDCandidates(DCandidates dCandidates) { _context.DCandidates.Add(dCandidates); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDCandidates", new { id = dCandidates.id }, dCandidates)); }
public async Task <IActionResult> PutDCandidates(int id, DCandidates dCandidates) { if (id != dCandidates.id) { return(BadRequest()); } _context.Entry(dCandidates).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DCandidatesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }