public async Task <IHttpActionResult> PutMotClefCategorie(int id, MotClefCategorie motClefCategorie) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != motClefCategorie.IdMotClefCategorie) { return(BadRequest()); } db.Entry(motClefCategorie).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MotClefCategorieExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetMotClefCategorie(int id) { MotClefCategorie motClefCategorie = await db.MotClefCategorie.FindAsync(id); if (motClefCategorie == null) { return(NotFound()); } return(Ok(motClefCategorie)); }
public async Task <IHttpActionResult> PostMotClefCategorie(MotClefCategorie motClefCategorie) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.MotClefCategorie.Add(motClefCategorie); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = motClefCategorie.IdMotClefCategorie }, motClefCategorie)); }
public async Task <IHttpActionResult> DeleteMotClefCategorie(int id) { MotClefCategorie motClefCategorie = await db.MotClefCategorie.FindAsync(id); if (motClefCategorie == null) { return(NotFound()); } db.MotClefCategorie.Remove(motClefCategorie); await db.SaveChangesAsync(); return(Ok(motClefCategorie)); }