protected void ProcessItem(Item item, Node parent) { var xml = new XmlSerializer(typeof(Sequencing)); var node = new Node { CourseId = this.course.Id, Name = item.Title, IsFolder = item.IsParent, ParentId = (parent != null ? (int?)parent.Id : null), Sequencing = xml.SerializeToXElemet(item.Sequencing) }; this.courseStorage.AddNode(node); if (item.IsParent && item.Items.Count > 0) { foreach (var subitem in item.Items) { this.ProcessItem(subitem, node); } } else { if (item.IdentifierRef != null) { var resource = this.manifest.Resources.ResourcesList.Where(r => r.Identifier == item.IdentifierRef).FirstOrDefault(); if (resource != null) { this.ProcessResource(node, resource); return; } } } }
protected void ProcessItem(Item item, Node parent) { var xml = new XmlSerializer(typeof(Sequencing)); var node = new Node { CourseId = _Course.Id, Name = item.Title, IsFolder = item.IsParent, ParentId = (parent != null ? (int?)parent.Id : null), Sequencing = item.Sequencing.ToString() // TODO: check if correct }; _CourseStorage.AddNode(node); if (item.IsParent && item.Items.Count > 0) { foreach (var subitem in item.Items) { ProcessItem(subitem, node); } } else { if (item.IdentifierRef != null) { var resource = _Manifest.Resources._Resources.Where(r => r.Identifier == item.IdentifierRef).FirstOrDefault(); if (resource != null) { ProcessResource(node, resource); return; } } } }