public async Task <IHttpActionResult> PutCM_Zone(int id, CM_Zone cM_Zone) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != cM_Zone.id) { return(BadRequest()); } db.Entry(cM_Zone).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CM_ZoneExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetCM_Zone(int id) { CM_Zone cM_Zone = await db.CM_Zone.FindAsync(id); if (cM_Zone == null) { return(NotFound()); } return(Ok(cM_Zone)); }
public async Task <IHttpActionResult> PostCM_Zone(CM_Zone cM_Zone) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CM_Zone.Add(cM_Zone); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = cM_Zone.id }, cM_Zone)); }
public async Task <IHttpActionResult> DeleteCM_Zone(int id) { CM_Zone cM_Zone = await db.CM_Zone.FindAsync(id); if (cM_Zone == null) { return(NotFound()); } db.CM_Zone.Remove(cM_Zone); await db.SaveChangesAsync(); return(Ok(cM_Zone)); }