コード例 #1
0
        /// <summary>
        /// Save profilephone
        /// </summary>
        /// <param name="profilePhone"></param>
        private void SaveProfilePhone(ProfilePhone profilePhone)
        {
            IEntityValidator entityValidator = EntityValidatorFactory.CreateValidator();

            if (entityValidator.IsValid(profilePhone))
            {
                _profilePhoneRepository.Add(profilePhone);
                _profilePhoneRepository.UnitOfWork.Commit();

                return;
            }

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

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