Example #1
0
        private string ResolveInheritance()
        {
            if (Parents.Any())
            {
                return($" : {Parents.Distinct().OrderBy(i => i).Aggregate((x, y) => $"{x}, {y}")}");
            }

            return(string.Empty);
        }
Example #2
0
 public IEnumerable <Breadcrumb> GetBreadcrumbs()
 {
     foreach (var parentCategory in Parents.Distinct())
     {
         if (!parentCategory.SeoPath.IsNullOrEmpty())
         {
             yield return(new CategoryBreadcrumb(parentCategory)
             {
                 SeoPath = parentCategory.SeoPath,
                 Url = parentCategory.SeoPath,
                 Title = parentCategory.Name,
             });
         }
     }
     if (!SeoPath.IsNullOrEmpty())
     {
         yield return(new CategoryBreadcrumb(this)
         {
             Title = Title,
             SeoPath = SeoPath,
             Url = Url
         });
     }
 }
Example #3
0
    public override string ToString()
    {
        Childrens.Distinct();
        Parents.Distinct();
        Pokemons.Distinct();
        var builder = new StringBuilder();

        builder.AppendLine($"{Name}");
        builder.AppendLine($"Company:");
        if (Company != null)
        {
            builder.AppendLine($"{Company.Name} {Company.Department} {Company.Salary:f2}");
        }
        builder.AppendLine($"Car:");
        if (Car != null)
        {
            builder.AppendLine($"{Car.Model} {Car.Speed}");
        }
        builder.AppendLine($"Pokemon:");
        foreach (var pokemon in Pokemons)
        {
            builder.AppendLine($"{pokemon.Name} {pokemon.Type}");
        }
        builder.AppendLine($"Parents:");
        foreach (var parent in Parents)
        {
            builder.AppendLine($"{parent.Name} {parent.Birthday}");
        }
        builder.AppendLine($"Children:");
        foreach (var children in Childrens)
        {
            builder.AppendLine($"{children.Name} {children.Birthday}");
        }

        return(builder.ToString());
    }