public string GenerateCode() { Header header = new Header() { LogoPath = this.LogoPath }; Footer footer = new Footer(); ContactSection contactSection = null; if (this.HasContactSection) { contactSection = new ContactSection(); } GoogleMapsSection googleMapsSection = null; if (this.HasGoogleMapsSection) { googleMapsSection = new GoogleMapsSection(); } MainContent main = new MainContent(this.SectionList.ToList(), contactSection, googleMapsSection); Head head = new Head(); Body body = new Body(header, main, footer); if (this.SectionList.Any(x => x.Type == SectionType.Gallery)) { head.AddAdditionalCss("<link rel=\"stylesheet\" href=\"css/gallery.css\">"); } return(TemplateManager.Current.PageTemplate .Replace("{HEAD}", head.GenerateCode()) .Replace("{BODY}", body.GenerateCode())); }
/// <summary> /// Constructor /// </summary> /// <param name="sectionList"></param> /// <param name="contactSection"></param> /// <param name="googleMapsSection"></param> public MainContent(List <Section> sectionList, ContactSection contactSection, GoogleMapsSection googleMapsSection) { this.SectionList = sectionList; this.ContactSection = contactSection; this.GoogleMapsSection = googleMapsSection; }