public async Task <ActionResult <ProduitsCommande> > PostProduitsCommande(ProduitsCommande produitsCommande) { _context.ProduitsCommandes.Add(produitsCommande); await _context.SaveChangesAsync(); return(CreatedAtAction("GetProduitsCommande", new { id = produitsCommande.Id }, produitsCommande)); }
public async Task <IActionResult> PutProduitsCommande(int id, ProduitsCommande produitsCommande) { if (id != produitsCommande.Id) { return(BadRequest()); } _context.Entry(produitsCommande).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProduitsCommandeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }