Beispiel #1
0
        public IHttpActionResult PutOwnerPropertyDescription(int id, OwnerPropertyDescription ownerPropertyDescription)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != ownerPropertyDescription.OwnerPropertyId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutCustomerInfo(int id, CustomerInfo customerInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != customerInfo.CustomerId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }