public async Task <IHttpActionResult> PutCM_Machine(int id, CM_Machine cM_Machine) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != cM_Machine.id) { return(BadRequest()); } db.Entry(cM_Machine).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CM_MachineExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetCM_Machine(int id) { CM_Machine cM_Machine = await db.CM_Machine.FindAsync(id); if (cM_Machine == null) { return(NotFound()); } return(Ok(cM_Machine)); }
public async Task <IHttpActionResult> PostCM_Machine(CM_Machine cM_Machine) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CM_Machine.Add(cM_Machine); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = cM_Machine.id }, cM_Machine)); }
public async Task <IHttpActionResult> DeleteCM_Machine(int id) { CM_Machine cM_Machine = await db.CM_Machine.FindAsync(id); if (cM_Machine == null) { return(NotFound()); } db.CM_Machine.Remove(cM_Machine); await db.SaveChangesAsync(); return(Ok(cM_Machine)); }