コード例 #1
0
        /// <summary>
        /// Save Profile Address
        /// </summary>
        /// <param name="profileAddress"></param>
        private void SaveProfileAddress(ProfileAddress profileAddress)
        {
            IEntityValidator entityValidator = EntityValidatorFactory.CreateValidator();

            if (entityValidator.IsValid(profileAddress))
            {
                _profileAddressRepository.Add(profileAddress);
                _profileAddressRepository.UnitOfWork.Commit();

                return;
            }

            throw new ApplicationValidationErrorsException(entityValidator.GetInvalidMessages(profileAddress));
        }
コード例 #2
0
        /// <summary>
        /// Save Profile Address
        /// </summary>
        /// <param name="profileAddress"></param>
        void SaveProfileAddress(ProfileAddress profileAddress)
        {
            var entityValidator = EntityValidatorFactory.CreateValidator();

            if (entityValidator.IsValid(profileAddress))//if entity is valid save.
            {
                //add profile address and commit changes
                _profileAddressRepository.Add(profileAddress);
                _profileAddressRepository.UnitOfWork.Commit();
            }
            else // if not valid throw validation errors
            {
                throw new ApplicationValidationErrorsException(entityValidator.GetInvalidMessages(profileAddress));
            }
        }