public IHttpActionResult PutProperty(int id, PropertyModel property)
        {
            // Validate the request
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != property.PropertyId)
            {
                return(BadRequest());
            }

            if (!PropertyExists(id))
            {
                return(BadRequest());
            }

            // Get the property record corresponding to the property ID, then
            //   update its properties to the values in the input PropertyModel object,
            //   and then set indicator that the record has been modified
            var dbProperty = db.Properties.Find(id);

            dbProperty.Update(property);
            db.Entry(dbProperty).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PropertyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw new Exception("Unable to update the property in the database.");
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutTenant(int id, TenantModel tenant)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tenant.TenantId)
            {
                return(BadRequest());
            }

            var dbTenant = db.Tenants.Find(id);

            dbTenant.Update(tenant);

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutLease(int id, LeaseModel lease)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != lease.LeaseId)
            {
                return(BadRequest());
            }

            var dbLease = db.Leases.Find(id);

            dbLease.Update(lease);

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutProperty(int id, PropertyModel property)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != property.PropertyId)
            {
                return(BadRequest());
            }

            var dbProperty = db.Properties.Find(id);

            dbProperty.Update(property);

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }