public async Task <ActionResult <DCanidate> > PostDCanidate(DCanidate dCanidate) { _context.DCanidates.Add(dCanidate); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDCanidate", new { id = dCanidate.Id }, dCanidate)); }
public async Task <IActionResult> PutDCanidate(int id, DCanidate dCanidate) { dCanidate.Id = id; _context.Entry(dCanidate).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DCanidateExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }