private void InitTree(LMPlatform.Models.Concept concept, ICollection<LMPlatform.Models.Concept> ch) { if (ch != null && ch.Any()) Children = ch.Select(c => new ConceptViewData(c, true)).ToList(); else return; }
public ConceptViewData(LMPlatform.Models.Concept concept) { Id = concept.Id; Name = concept.Name; ShortName = concept.Name.Length <= 20 ? concept.Name : String.Format("{0}...", concept.Name.Substring(0, 20)); Container = concept.Container; ParentId = concept.ParentId.GetValueOrDefault(); IsGroup = concept.IsGroup; Published = (concept.IsGroup && concept.Children.Any() && concept.Children.All(c => c.Published)) || (!concept.IsGroup && concept.Published); ReadOnly = concept.ReadOnly; HasData = !String.IsNullOrEmpty(Container); Prev = concept.PrevConcept; Next = concept.NextConcept; SubjectName = concept.Subject.Name; }
public ConceptViewData(LMPlatform.Models.Concept concept, Boolean buildTree) : this(concept) { if (buildTree) { Children = new List<ConceptViewData>(); InitTree(concept, concept.Children); } }