public IHttpActionResult PutBusinessAddress(int id, BusinessAddress businessAddress)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != businessAddress.BusinessAddressID)
            {
                return BadRequest();
            }

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

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

            return StatusCode(HttpStatusCode.NoContent);
        }
        public BusinessAddress CreateBusinessAddress(BusinessAddress businessAddress)
        {
            db.BusinessAddresses.Add(businessAddress);
            db.SaveChanges();

            return businessAddress;
        }
        public BusinessAddress Create(BusinessAddress oBusinessAddress)
        {
            if (oBusinessAddress != null)
            {
                return oBusinessAddressesRepo.CreateBusinessAddress(oBusinessAddress);
            }

            return null;
        }
        public IHttpActionResult PostBusinessAddress(BusinessAddress businessAddress)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.BusinessAddresses.Add(businessAddress);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = businessAddress.BusinessAddressID }, businessAddress);
        }
        public void UpdateBusinessAddress(int id, BusinessAddress businessAddress)
        {
            db.Entry(businessAddress).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }
        }
        /// <summary>
        /// Converts this instance of <see cref="BusinessAddressDTO"/> to an instance of <see cref="BusinessAddress"/>.
        /// </summary>
        /// <param name="dto"><see cref="BusinessAddressDTO"/> to convert.</param>
        public static BusinessAddress ToEntity(this BusinessAddressDTO dto)
        {
            if (dto == null) return null;

            var entity = new BusinessAddress();

            entity.BusinessAddressID = dto.BusinessAddressID;
            entity.BusinessID = dto.BusinessID;
            entity.AddressID = dto.AddressID;
            entity.IsPrimary = dto.IsPrimary;

            dto.OnEntity(entity);

            return entity;
        }
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="BusinessAddress"/> converted from <see cref="BusinessAddressDTO"/>.</param>
 static partial void OnEntity(this BusinessAddressDTO dto, BusinessAddress entity);