public IHttpActionResult PostLease(LeaseModel lease)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var dbLease = new Lease();

            dbLease.Update(lease);
            db.Leases.Add(dbLease);
            db.SaveChanges();

            lease.LeaseId = dbLease.LeaseId;

            return CreatedAtRoute("DefaultApi", new { id = lease.LeaseId }, lease);
        }
        public IHttpActionResult PostLease(LeaseModel lease)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            //Set up new Lease object,
            //  and populate it with the values from
            //  the input LeaseModel object
            Lease dbLease = new Lease();
            dbLease.Update(lease);

            // Add the new Lease object to the list of Lease objects
            db.Leases.Add(dbLease);

            try
            {
                db.SaveChanges();
            }
            catch (Exception)
            {

                throw new Exception("Unable to add the lease to the database.");
            }

            // Update the LeaseModel object with the new lease ID
            //  that was placed in the Lease object after the changes
            //  were saved to the DB
            lease.LeaseId = dbLease.LeaseId;
            return CreatedAtRoute("DefaultApi", new { id = dbLease.LeaseId }, lease);
        }