public virtual AggregationItem ToAggregationItem(searchDto.AggregationItem itemDto, string currentLanguage) { var result = ServiceLocator.Current.GetInstance <CatalogFactory>().CreateAggregationItem(); result.InjectFrom <NullableAndEnumValueInjecter>(itemDto); if (itemDto.Labels != null) { result.Label = itemDto.Labels.Where(l => string.Equals(l.Language, currentLanguage, StringComparison.OrdinalIgnoreCase)) .Select(l => l.Label) .FirstOrDefault(); } if (string.IsNullOrEmpty(result.Label) && itemDto.Value != null) { result.Label = itemDto.Value.ToString(); } return(result); }
public virtual AggregationItem ToAggregationItem(searchDto.AggregationItem itemDto, string currentLanguage) { var result = new AggregationItem(); result.Value = itemDto.Value; result.IsApplied = itemDto.IsApplied ?? false; result.Count = itemDto.Count ?? 0; if (itemDto.Labels != null) { result.Label = itemDto.Labels.Where(l => string.Equals(l.Language, currentLanguage, StringComparison.OrdinalIgnoreCase)) .Select(l => l.Label) .FirstOrDefault(); } if (string.IsNullOrEmpty(result.Label) && itemDto.Value != null) { result.Label = itemDto.Value.ToString(); } return(result); }
public static AggregationItem ToAggregationItem(this searchDto.AggregationItem itemDto, string currentLanguage) { return(CatalogConverterInstance.ToAggregationItem(itemDto, currentLanguage)); }