/// <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)); }
/// <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)); } }