public async Task <IHttpActionResult> PutChapitre(int id, Chapitre chapitre) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != chapitre.ChapitreID) { return(BadRequest()); } db.Entry(chapitre).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ChapitreExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
// PUT: odata/Reponses(5) public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <Reponses> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Reponses reponses = await db.Reponses.FindAsync(key); if (reponses == null) { return(NotFound()); } patch.Put(reponses); try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReponsesExists(key)) { return(NotFound()); } else { throw; } } return(Updated(reponses)); }