internal void LoadNetwork(AromaContext db) { this.Parent = db.Clients.Find(this.ClientId).ResellerID; var children = (from item in db.Clients where item.ResellerID == this.ClientId select item.ClientId).ToArray(); this.DirectChildCount = children.Length; this.DescendantCount = this.DirectChildCount; this.Children = new List<NetworkClient>(); foreach (var id in children) { var child = new NetworkClient(); child.LoadNetwork(db, id); this.Children.Add(child); this.DescendantCount += child.DescendantCount; } }
public ActionResult Networkrelationship(int clientId = 0) { var networkClient = new NetworkClient(); networkClient.LoadNetwork(this.db, clientId); return this.View(networkClient); }