public UpdateAddressSubAttribute(ApplicationDbContext dbContext, PersonsAttribute personsAttributeEntity, List<AddressSubAttributeDto> addressSubAttributeDtoList, string applicationUserId)
 {
     _addressSubAttributeDtoList = addressSubAttributeDtoList;
     _personsAttributeEntity = personsAttributeEntity;
     _applicationUserId = applicationUserId;
     _dbContext = dbContext;
 }
 public UpdateTimeFrameSubAttribute(ApplicationDbContext dbContext, PersonsAttribute personsAttributeEntity, List<TimeFrameSubAttributeDto> timeFrameSubAttributeDtoList, string applicationUserId)
 {
     _timeFrameSubAttributeDtoList = timeFrameSubAttributeDtoList;
     _personsAttributeEntity = personsAttributeEntity;
     _applicationUserId = applicationUserId;
     _dbContext = dbContext;
 }
 public UpdatePhoneNumberSubAttribute(ApplicationDbContext dbContext, PersonsAttribute personsAttributeEntity, List<PhoneNumberSubAttributeDto> phoneNumberSubAttributeDtoList, string applicationUserId)
 {
     _phoneNumberSubAttributeDtoList = phoneNumberSubAttributeDtoList;
     _personsAttributeEntity = personsAttributeEntity;
     _applicationUserId = applicationUserId;
     _dbContext = dbContext;
 }
        private void TranferInfo(PersonsAttributeDto dto, PersonsAttribute entity)
        {
            if (dto.IsNew)
            {
                entity.Id = Guid.NewGuid().ToString();
            }

            entity.PersonsAttributeCategoryId = dto.PersonsAttributeCategoryId;
        }
        private void Add(PersonsAttributeDto personsAttributeDto)
        {
            var personsAttributeEntity = new PersonsAttribute();
            TranferInfo(personsAttributeDto, personsAttributeEntity);

            _personEntity.PersonsAttribute.Add(personsAttributeEntity);

            //update subAttrbutes (
            var personalSubAttribute = new UpdatePersonalSubAttribute(_dbContext, personsAttributeEntity, personsAttributeDto.PersonalSubAttributeDtos.ToList() , _applicationUserId);
            personalSubAttribute.PerformAction();

            var addressSubAttribute = new UpdateAddressSubAttribute(_dbContext, personsAttributeEntity, personsAttributeDto.AddressSubAttributeDtos.ToList(), _applicationUserId);
            addressSubAttribute.PerformAction();

            var phoneNumberSubAttribute = new UpdatePhoneNumberSubAttribute(_dbContext, personsAttributeEntity, personsAttributeDto.PhoneNumberSubAttributeDtos.ToList(), _applicationUserId);
            phoneNumberSubAttribute.PerformAction();

            var updateTimeFrameSubAttribute = new UpdateTimeFrameSubAttribute(_dbContext, personsAttributeEntity, personsAttributeDto.TimeFrameSubAttributeDtos.ToList(), _applicationUserId);
            updateTimeFrameSubAttribute.PerformAction();
        }