You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/labs/Teacher/Infrastructure/Extensions/TreeEntityExtensions.cs

25 lines
741 B

//using Infrastructure.Domain;
//using System.Collections.Generic;
//using System.Linq;
//namespace Infrastructure.Extensions
//{
// public static class TreeEntityExtensions
// {
// public static List<T> ToTree<T>(this List<T> list) where T : BaseTreeEntity<T>
// {
// if (list != null)
// {
// foreach (var item in list)
// {
// if (item.ParentId.HasValue)
// {
// item.Parent = list.FirstOrDefault(o => o.Id == item.ParentId.Value);
// item.Parent?.Children.Add(item);
// }
// }
// }
// return list;
// }
// }
//}