Ejemplo n.º 1
0
        public IHttpActionResult PostPetOwner0136(PetOwner0136 petOwner0136)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PetOwner0136.Add(petOwner0136);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (PetOwner0136Exists(petOwner0136.OwnerID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = petOwner0136.OwnerID }, petOwner0136));
        }
Ejemplo n.º 2
0
        public IHttpActionResult PutPetOwner0136(int id, PetOwner0136 petOwner0136)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != petOwner0136.OwnerID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 3
0
        public IHttpActionResult GetPetOwner0136(int id)
        {
            PetOwner0136 petOwner0136 = db.PetOwner0136.Find(id);

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

            return(Ok(petOwner0136));
        }
Ejemplo n.º 4
0
        public IHttpActionResult DeletePetOwner0136(int id)
        {
            PetOwner0136 petOwner0136 = db.PetOwner0136.Find(id);

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

            db.PetOwner0136.Remove(petOwner0136);
            db.SaveChanges();

            return(Ok(petOwner0136));
        }