internal product_feature_value GetFeatureValue(string value, product_feature feature) { if (string.IsNullOrWhiteSpace(value)) { return null; } var filter = new Dictionary<string, string> { { "id_feature", feature.id.Value.ToString(CultureInfo.InvariantCulture) }, { "value", value }, }; var featureValues = _apiFactory.FeatureValuesFactory.GetByFilter(filter, null, null); product_feature_value featureValue; if (featureValues == null || !featureValues.Any()) { featureValue = new product_feature_value { id_feature = feature.id, value = new List<language> { new language(1, value) } }; featureValue = _apiFactory.FeatureValuesFactory.Add(featureValue); } else { featureValue = featureValues.First(); } return featureValue; }
internal static product MapFeature(product product, product_feature_value featureValue) { if (featureValue == null) { return(product); } product.associations.product_features.Add( new product_feature { id = featureValue.id_feature.Value, id_feature_value = featureValue.id.Value }); return(product); }
internal static product MapFeature(product product, product_feature_value featureValue) { if (featureValue == null) { return product; } product.associations.product_features.Add( new product_feature { id = featureValue.id_feature.Value, id_feature_value = featureValue.id.Value }); return product; }