public IHttpActionResult Put(int id, BDescription bDescription) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bDescription.billet_id) { return(BadRequest()); } db.Entry(bDescription).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BDescriptionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Get(int id) { BDescription bDescription = db.BDescriptions.Find(id); if (bDescription == null) { return(NotFound()); } return(Ok(bDescription)); }
public IHttpActionResult Post(BDescription bDescription) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.BDescriptions.Add(bDescription); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = bDescription.billet_id }, bDescription)); }
public IHttpActionResult Delete(int id) { BDescription bDescription = db.BDescriptions.Find(id); if (bDescription == null) { return(NotFound()); } db.BDescriptions.Remove(bDescription); db.SaveChanges(); return(Ok(bDescription)); }