public int GetHeight(int id) { var container = new WindsorContainer(); container.Register(Component.For <ICompanyHierarchy>().ImplementedBy <CompanyHierarchy>().LifestyleSingleton()); // Resolve an object of type ICompanyHierarchy (ask the container for an instance) // This is analagous to calling new() in a non-IoC application. _CompanyHierarchy = container.Resolve <ICompanyHierarchy>(); Common.Models.Node n = _CompanyHierarchy.Getnode(id); return(_CompanyHierarchy.GetHeight(n)); }
public HttpResponseMessage Get_all_children(int id) { var container = new WindsorContainer(); container.Register(Component.For <ICompanyHierarchy>().ImplementedBy <CompanyHierarchy>().LifestyleSingleton()); // Resolve an object of type ICompanyHierarchy (ask the container for an instance) // This is analagous to calling new() in a non-IoC application. _CompanyHierarchy = container.Resolve <ICompanyHierarchy>(); Common.Models.Node node = _CompanyHierarchy.Getnode(id); IEnumerable <Common.Models.Node> resultsnodes = _CompanyHierarchy.Get_all_children(node); return(Share.Json <Common.Models.Node>(resultsnodes)); }