public async Task <IHttpActionResult> PutInstallZone(int id, InstallZone installZone) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != installZone.InstallZoneId) { return(BadRequest()); } db.Entry(installZone).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InstallZoneExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetInstallZone(int id) { InstallZone installZone = await db.InstallZones.FindAsync(id); if (installZone == null) { return(NotFound()); } return(Ok(installZone)); }
public async Task <IHttpActionResult> PostInstallZone(InstallZone installZone) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.InstallZones.Add(installZone); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = installZone.InstallZoneId }, installZone)); }
public async Task <IHttpActionResult> DeleteInstallZone(int id) { InstallZone installZone = await db.InstallZones.FindAsync(id); if (installZone == null) { return(NotFound()); } db.InstallZones.Remove(installZone); await db.SaveChangesAsync(); return(Ok(installZone)); }