public async Task <IHttpActionResult> PostZoneInfoMetaData(ZoneInfoMetaData zoneInfoMetaData) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ZoneInfoMetaDatas.Add(zoneInfoMetaData); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (ZoneInfoMetaDataExists(zoneInfoMetaData.ZoneId)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = zoneInfoMetaData.ZoneId }, zoneInfoMetaData)); }
public async Task <IHttpActionResult> PutZoneInfoMetaData(string id, ZoneInfoMetaData zoneInfoMetaData) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != zoneInfoMetaData.ZoneId) { return(BadRequest()); } db.Entry(zoneInfoMetaData).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ZoneInfoMetaDataExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetZoneInfoMetaData(string id) { ZoneInfoMetaData zoneInfoMetaData = await db.ZoneInfoMetaDatas.FindAsync(id); if (zoneInfoMetaData == null) { return(NotFound()); } return(Ok(zoneInfoMetaData)); }
public async Task <IHttpActionResult> DeleteZoneInfoMetaData(string id) { ZoneInfoMetaData zoneInfoMetaData = await db.ZoneInfoMetaDatas.FindAsync(id); if (zoneInfoMetaData == null) { return(NotFound()); } db.ZoneInfoMetaDatas.Remove(zoneInfoMetaData); await db.SaveChangesAsync(); return(Ok(zoneInfoMetaData)); }