/// <summary> /// Initializes a new instance of the <see cref="RenderPagePropertiesViewModel" /> class. /// </summary> /// <param name="page">The page.</param> public RenderPagePropertiesViewModel(Models.PageProperties page = null) { Tags = new List <string>(); if (page != null) { Description = page.Description; CustomCss = page.CustomCss; CustomJS = page.CustomJS; UseCanonicalUrl = page.UseCanonicalUrl; UseNoFollow = page.UseNoFollow; UseNoIndex = page.UseNoIndex; NodeCountInSitemap = page.NodeCountInSitemap; MetaKeywords = page.MetaKeywords; MetaDescription = page.MetaDescription; IsArchived = page.IsArchived; if (page.Image != null) { MainImage = new RenderPageImageViewModel(page.Image); } if (page.FeaturedImage != null) { FeaturedImage = new RenderPageImageViewModel(page.FeaturedImage); } if (page.SecondaryImage != null) { SecondaryImage = new RenderPageImageViewModel(page.SecondaryImage); } if (page.Category != null) { Category = new RenderPageCategoryViewModel(page.Category); } if (page.PageTags != null) { foreach (var tag in page.PageTags.Distinct()) { var tagName = tag.Tag.Name; if (!Tags.Contains(tagName)) { Tags.Add(tagName); } } } } }
/// <summary> /// Initializes a new instance of the <see cref="RenderPagePropertiesViewModel" /> class. /// </summary> /// <param name="page">The page.</param> public RenderPagePropertiesViewModel(Models.PageProperties page = null) { Tags = new List<string>(); if (page != null) { Description = page.Description; CustomCss = page.CustomCss; CustomJS = page.CustomJS; UseCanonicalUrl = page.UseCanonicalUrl; UseNoFollow = page.UseNoFollow; UseNoIndex = page.UseNoIndex; IsInSitemap = page.IsInSitemap; MetaKeywords = page.MetaKeywords; MetaDescription = page.MetaDescription; IsArchived = page.IsArchived; if (page.Image != null) { MainImage = new RenderPageImageViewModel(page.Image); } if (page.FeaturedImage != null) { FeaturedImage = new RenderPageImageViewModel(page.FeaturedImage); } if (page.SecondaryImage != null) { SecondaryImage = new RenderPageImageViewModel(page.SecondaryImage); } if (page.Category != null) { Category = new RenderPageCategoryViewModel(page.Category); } if (page.PageTags != null) { foreach (var tag in page.PageTags.Distinct()) { var tagName = tag.Tag.Name; if (!Tags.Contains(tagName)) { Tags.Add(tagName); } } } } }