public async Task <IHttpActionResult> Putz_PLC_Device(int id, z_PLC_Device z_PLC_Device) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != z_PLC_Device.Id) { return(BadRequest()); } db.Entry(z_PLC_Device).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!z_PLC_DeviceExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> Getz_PLC_Device(int id) { z_PLC_Device z_PLC_Device = await db.z_PLC_Device.FindAsync(id); if (z_PLC_Device == null) { return(NotFound()); } return(Ok(z_PLC_Device)); }
public async Task <IHttpActionResult> Postz_PLC_Device(z_PLC_Device z_PLC_Device) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.z_PLC_Device.Add(z_PLC_Device); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = z_PLC_Device.Id }, z_PLC_Device)); }
public async Task <IHttpActionResult> Deletez_PLC_Device(int id) { z_PLC_Device z_PLC_Device = await db.z_PLC_Device.FindAsync(id); if (z_PLC_Device == null) { return(NotFound()); } db.z_PLC_Device.Remove(z_PLC_Device); await db.SaveChangesAsync(); return(Ok(z_PLC_Device)); }