public async Task <ActionResult <TypeDroit> > PostTypeDroit(TypeDroit typeDroit) { _context.typeDroits.Add(typeDroit); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTypeDroit", new { id = typeDroit.Id }, typeDroit)); }
public async Task <IActionResult> PutTypeDroit(int id, TypeDroit typeDroit) { if (id != typeDroit.Id) { return(BadRequest()); } _context.Entry(typeDroit).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypeDroitExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }