コード例 #1
0
 private void AddToList(UserDataPropertyMapping propertyMapping, List <UserDataModel> userDataList, UserModel user)
 {
     if (propertyMapping.ChildrenMappings != null &&
         propertyMapping.ChildrenMappings.All(x => !string.IsNullOrEmpty(x.PropertyValue)) ||
         !string.IsNullOrEmpty(propertyMapping.PropertyValue))
     {
         userDataList.Add(CreateUserDataModel(user, propertyMapping));
     }
 }
コード例 #2
0
        private UserDataModel CreateUserDataModel(UserModel user, UserDataPropertyMapping propertyMapping)
        {
            var userDataModel = new UserDataModel
            {
                User         = user,
                UserDataType = GetAllUserDataTypes.Single(x => x.DataTypeValue == propertyMapping.DataTypeValue),
                Value        = propertyMapping.PropertyValue,
                ActiveTo     = propertyMapping.ValueValidTo,
            };

            if (propertyMapping.ChildrenMappings != null)
            {
                var childrenDataModels = new List <UserDataModel>();

                foreach (var childrenMapping in propertyMapping.ChildrenMappings)
                {
                    childrenDataModels.Add(CreateUserDataModel(user, childrenMapping));
                }

                userDataModel.ChildrenUserData = childrenDataModels;
            }

            return(userDataModel);
        }