public IHttpActionResult PostBoundryWall(BoundryWall boundryWall) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.BoundryWalls.Add(boundryWall); try { db.SaveChanges(); } catch (DbUpdateException) { if (BoundryWallExists(boundryWall.BoundryWallAvailable)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = boundryWall.BoundryWallAvailable }, boundryWall)); }
public IHttpActionResult PutBoundryWall(string id, BoundryWall boundryWall) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != boundryWall.BoundryWallAvailable) { return(BadRequest()); } db.Entry(boundryWall).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BoundryWallExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetBoundryWall(string id) { BoundryWall boundryWall = db.BoundryWalls.Find(id); if (boundryWall == null) { return(NotFound()); } return(Ok(boundryWall)); }
public IHttpActionResult DeleteBoundryWall(string id) { BoundryWall boundryWall = db.BoundryWalls.Find(id); if (boundryWall == null) { return(NotFound()); } db.BoundryWalls.Remove(boundryWall); db.SaveChanges(); return(Ok(boundryWall)); }