public async Task <ActionResult <TeAffectation> > PostTeAffectation(TeAffectation teAffectation) { _context.TeAffectations.Add(teAffectation); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTeAffectation", new { id = teAffectation.Id }, teAffectation)); }
public async Task <IActionResult> PutTeAffectation(int id, TeAffectation teAffectation) { if (id != teAffectation.Id) { return(BadRequest()); } _context.Entry(teAffectation).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeAffectationExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }