internal static Attempt <TreeNodeCollection> TryLoadFromLegacyTree(this ApplicationTree appTree, string id, FormDataCollection formCollection, UrlHelper urlHelper, string currentSection) { var xTreeAttempt = appTree.TryGetXmlTree(id, formCollection); if (xTreeAttempt.Success == false) { return(Attempt <TreeNodeCollection> .Fail(xTreeAttempt.Exception)); } return(Attempt.Succeed(LegacyTreeDataConverter.ConvertFromLegacy(id, xTreeAttempt.Result, urlHelper, currentSection, formCollection))); }
internal static Attempt <MenuItemCollection> TryGetMenuFromLegacyTreeNode(this ApplicationTree appTree, string parentId, string nodeId, FormDataCollection formCollection, UrlHelper urlHelper) { var xTreeAttempt = appTree.TryGetXmlTree(parentId, formCollection); if (xTreeAttempt.Success == false) { return(Attempt <MenuItemCollection> .Fail(xTreeAttempt.Exception)); } var currentSection = formCollection.GetRequiredString("section"); var result = LegacyTreeDataConverter.ConvertFromLegacyMenu(nodeId, xTreeAttempt.Result, currentSection); if (result == null) { return(Attempt <MenuItemCollection> .Fail(new ApplicationException("Could not find the node with id " + nodeId + " in the collection of nodes contained with parent id " + parentId))); } return(Attempt.Succeed(result)); }