public async Task <IHttpActionResult> PutArmures(int id, Armures armures) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != armures.Id_armure) { return(BadRequest()); } db.Entry(armures).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArmuresExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetArmures(int id) { Armures armures = await db.Armures.FindAsync(id); if (armures == null) { return(NotFound()); } return(Ok(armures)); }
public async Task <IHttpActionResult> PostArmures(Armures armures) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Armures.Add(armures); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = armures.Id_armure }, armures)); }
public async Task <IHttpActionResult> DeleteArmures(int id) { Armures armures = await db.Armures.FindAsync(id); if (armures == null) { return(NotFound()); } db.Armures.Remove(armures); await db.SaveChangesAsync(); return(Ok(armures)); }