public async Task <IActionResult> PutInitiatif(int id, Initiatif initiatif) { if (id != initiatif.InitiatifID) { return(BadRequest()); } _context.Entry(initiatif).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InitiatifExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Initiatif> > PostInitiatif(Initiatif initiatif) { _context.Initiatifs.Add(initiatif); await _context.SaveChangesAsync(); return(CreatedAtAction("GetInitiatif", new { id = initiatif.InitiatifID }, initiatif)); }