public IHttpActionResult PutDemandeExamen(int id, DemandeExamen demandeExamen) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != demandeExamen.DemandeExamenId) { return(BadRequest()); } db.Entry(demandeExamen).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DemandeExamenExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetDemandeExamen(int id) { DemandeExamen demandeExamen = db.DemandeExamen.Find(id); if (demandeExamen == null) { return(NotFound()); } return(Ok(demandeExamen)); }
public IHttpActionResult PostDemandeExamen(DemandeExamen demandeExamen) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DemandeExamen.Add(demandeExamen); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = demandeExamen.DemandeExamenId }, demandeExamen)); }
public IHttpActionResult DeleteDemandeExamen(int id) { DemandeExamen demandeExamen = db.DemandeExamen.Find(id); if (demandeExamen == null) { return(NotFound()); } db.DemandeExamen.Remove(demandeExamen); db.SaveChanges(); return(Ok(demandeExamen)); }