Exemple #1
0
        public IHttpActionResult PutBookedPlace(int id, BookedPlace bookedPlace)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != bookedPlace.BookedPlaceId)
            {
                return(BadRequest());
            }

            db.Entry(bookedPlace).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BookedPlaceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #2
0
        public IHttpActionResult GetBookedPlace(int id)
        {
            BookedPlace bookedPlace = db.BookedPlaces.Find(id);

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

            return(Ok(bookedPlace));
        }
Exemple #3
0
        public IHttpActionResult DeleteBookedPlace(int id)
        {
            BookedPlace bookedPlace = db.BookedPlaces.Find(id);

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

            db.BookedPlaces.Remove(bookedPlace);
            db.SaveChanges();

            return(Ok(bookedPlace));
        }