public IHttpActionResult PutDemandeModification(int id, DemandeModification demandeModification) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != demandeModification.DemandeModificationId) { return(BadRequest()); } db.Entry(demandeModification).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DemandeModificationExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetDemandeModification(int id) { DemandeModification demandeModification = db.DemandeModifications.Find(id); if (demandeModification == null) { return(NotFound()); } return(Ok(demandeModification)); }
public IHttpActionResult PostDemandeModification(DemandeModification demandeModification) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DemandeModifications.Add(demandeModification); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = demandeModification.DemandeModificationId }, demandeModification)); }
public IHttpActionResult DeleteDemandeModification(int id) { DemandeModification demandeModification = db.DemandeModifications.Find(id); if (demandeModification == null) { return(NotFound()); } db.DemandeModifications.Remove(demandeModification); db.SaveChanges(); return(Ok(demandeModification)); }