Exemple #1
0
        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));
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        public IHttpActionResult GetBoundryWall(string id)
        {
            BoundryWall boundryWall = db.BoundryWalls.Find(id);

            if (boundryWall == null)
            {
                return(NotFound());
            }

            return(Ok(boundryWall));
        }
Exemple #4
0
        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));
        }