public static Task <string> RenderPage(IServiceScopeFactory scopeFactory, GeneratorConfig config, InterestFeature feature)
        {
            using (var serviceScope = scopeFactory.CreateScope())
            {
                var helper = RenderHelper.GetRendererHelper(serviceScope);

                var model = new InterestFeaturePage
                {
                    GeneratorConfig = config,
                    Breadcrumbs     = new List <(string href, string text, bool current)> {
                        ("/", "Home", true), ("/species/", "Species", true)
                    },
                    CurrentSection  = "Species",
                    InterestFeature = feature,
                    Title           = StringHelpers.RemoveHTMLTags(String.Format("{0} ({1}) - {2}", feature.LayTitle, feature.Name, Page.DefaultTitle)),
                    MetaDescription = String.Format("Species account of Habitats Directive feature {0}, {1}, {2}. The Habitats Directive: selection of Special Areas of Conservation in the UK, second edition, JNCC (2002)", feature.Code, feature.LayTitle, feature.Name),
                    MetaKeywords    = new List <string> {
                        feature.Code, feature.LayTitle, feature.Name
                    }
                };

                return(helper.RenderViewToStringAsync("Views/SpeciesInterestFeature.cshtml", model));
            }
        }
    }
Ejemplo n.º 2
0
        public static Task <string> RenderPage(IServiceScopeFactory scopeFactory, GeneratorConfig config, InterestFeature feature)
        {
            using (var serviceScope = scopeFactory.CreateScope())
            {
                var    helper    = RenderHelper.GetRendererHelper(serviceScope);
                var    isHabitat = InterestFeatureHelpers.IsHabitatCode(feature.Code);
                string code      = InterestFeatureHelpers.GetPlainIntegerCode(feature.Code);

                var breadcrumbs = new List <(string href, string text, bool current)> {
                    ("/", "Home", true)
                };


                if (isHabitat)
                {
                    breadcrumbs.Add(("/habitat/", "Habitats", true));
                    breadcrumbs.Add((string.Format("/habitat/{0}", feature.Code), $"{code} {feature.Name}", true));
                }
                else
                {
                    breadcrumbs.Add(("/species/", "Species", true));
                    breadcrumbs.Add((string.Format("/species/{0}", feature.Code), $"{code} {feature.Name}", true));
                }

                var model = new InterestFeaturePage
                {
                    GeneratorConfig = config,
                    Breadcrumbs     = breadcrumbs,
                    CurrentSection  = isHabitat ? "Habitat" : "Species",
                    InterestFeature = feature,
                    Title           = StringHelpers.RemoveHTMLTags(String.Format("{0} ({1}) Distribution - {2}", feature.LayTitle, feature.Name, Page.DefaultTitle)),
                    MetaDescription = String.Format("Distribution of Habitats Directive feature {0}, {1}. The Habitats Directive: selection of Special Areas of Conservation in the UK, second edition, JNCC (2002)", feature.Code, feature.Name),
                    MetaKeywords    = new List <string> {
                        feature.Code, feature.Name
                    }
                };

                return(helper.RenderViewToStringAsync("Views/InterestFeatureDistribution.cshtml", model));
            }
        }