static WorkSpecificationSection SpecToolSectionToWorkSpecificationSection(SpecToolSection specToolSection, WorkSpecificationSection parent = null) { var section = new WorkSpecificationSection { MolioSectionGuid = specToolSection.Id, Heading = specToolSection.Title, SectionNo = int.Parse(specToolSection.Number.Trim('.').Split('.').Last()), Body = string.Join("\n", specToolSection.Groups.FirstOrDefault(g => g.Name == "Projektspecifik beskrivelse")?.Contents.Select(c => c.MasterText)) }; section.Sections = specToolSection.Sections .Select(s => SpecToolSectionToWorkSpecificationSection(s, section)) .ToList(); return(section); }
static ConstructionElementSpecificationSection SpecSectionToConstructionElementSpecificationSection(SpecToolSection specToolSection, ConstructionElementSpecificationSection parent = null) { var section = new ConstructionElementSpecificationSection { MolioSectionGuid = specToolSection.Id, Heading = specToolSection.Title, SectionNo = int.Parse(specToolSection.Number.Trim('.').Split('.').Last()) }; section.Sections = specToolSection.Sections .Select(s => SpecSectionToConstructionElementSpecificationSection(s, section)) .ToList(); return(section); }