Ejemplo n.º 1
0
        public static AggregationItem ToAggregationItem(this catalogDto.AggregationItem itemDto, string currentLanguage)
        {
            var result = new AggregationItem
            {
                Value     = itemDto.Value,
                IsApplied = itemDto.IsApplied ?? false,
                Count     = itemDto.Count ?? 0,
                Lower     = itemDto.RequestedLowerBound,
                Upper     = itemDto.RequestedUpperBound,
            };

            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);
        }
Ejemplo n.º 2
0
 public static AggregationItem ToAggregationItem(this catalogDto.AggregationItem itemDto, string currentLanguage)
 {
     return(CatalogConverterInstance.ToAggregationItem(itemDto, currentLanguage));
 }