Exemplo n.º 1
0
        /// <summary>
        /// Delete profile address
        /// </summary>
        /// <param name="profileAddress"></param>
        public void DeleteProfileAddress(ProfileAddress profileAddress)
        {
            var address = _addressRepository.Get(profileAddress.AddressId);

            if (address != null)
            {
                _profileAddressRepository.Remove(profileAddress);
                _profileAddressRepository.UnitOfWork.Commit();

                _addressRepository.Remove(address);
                _addressRepository.UnitOfWork.Commit();
            }
            else
            {
                LoggerFactory.CreateLog().LogWarning(Messages.warning_CannotRemoveNonExistingAddress);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Delete profile address
        /// </summary>
        /// <param name="profileId"></param>
        public void DeleteProfileAddress(ProfileAddress profileAddress)
        {
            var address = _addressRepository.Get(profileAddress.AddressId);

            if (address != null) //if address exist
            {
                _profileAddressRepository.Remove(profileAddress);
                //commit changes
                _profileAddressRepository.UnitOfWork.Commit();

                _addressRepository.Remove(address);
                //commit changes
                _addressRepository.UnitOfWork.Commit();
            }
            else //the customer not exist, cannot remove
            {
                LoggerFactory.CreateLog().LogWarning(Messages.warning_CannotRemoveNonExistingProfile);
            }
        }