public IHttpActionResult PutBouqette(int id, Bouqette bouqette) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != bouqette.Id) { return BadRequest(); } db.Entry(bouqette).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BouqetteExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostBouqette(Bouqette bouqette) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Bouqettes.Add(bouqette); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = bouqette.Id }, bouqette); }