private SitePageEditModel ToUiEditModel(SitePage dbModel, bool isHomePageSection) { var model = new SitePageEditModel() { Key = dbModel.Key, BreadcrumbName = dbModel.BreadcrumbName, Content = dbModel.Content, PageHeader = dbModel.PageHeader, Title = dbModel.Title, SitePageId = dbModel.SitePageId, PublishDateTimeUtc = dbModel.PublishDateTimeUtc, IsLive = dbModel.IsLive, ExcludePageFromSiteMapXml = dbModel.ExcludePageFromSiteMapXml, LiveUrlPath = UrlBuilder.BlogUrlPath(dbModel.SitePageSection.Key, dbModel.Key), PreviewUrlPath = UrlBuilder.BlogPreviewUrlPath(dbModel.SitePageId), MetaDescription = dbModel.MetaDescription, PageType = dbModel.PageType, ReviewBestValue = dbModel.ReviewBestValue, ReviewItemName = dbModel.ReviewItemName, ReviewRatingValue = dbModel.ReviewRatingValue, ReviewWorstValue = dbModel.ReviewWorstValue, MetaKeywords = dbModel.MetaKeywords, AllowsComments = dbModel.AllowsComments, IsSectionHomePage = dbModel.IsSectionHomePage, }; var mc = new ModelConverter(this.cacheService); foreach (var photo in dbModel.Photos.OrderBy(x => x.Rank)) { model.BlogPhotos.Add(new SitePagePhotoModel { SitePagePhotoId = photo.SitePagePhotoId, IsDefault = photo.IsDefault, PhotoUrl = photo.PhotoUrl, PhotoCdnUrl = mc.ConvertBlobToCdnUrl(photo.PhotoUrl), PhotoThumbCdnUrl = mc.ConvertBlobToCdnUrl(photo.PhotoThumbUrl), PhotoFullScreenCdnUrl = mc.ConvertBlobToCdnUrl(photo.PhotoFullScreenUrl), PhotoPreviewCdnUrl = mc.ConvertBlobToCdnUrl(photo.PhotoPreviewUrl), Title = photo.Title, Description = photo.Description }); } foreach (var tagItem in dbModel.SitePageTags.OrderBy(x => x.Tag.Name)) { model.BlogTags.Add(tagItem.Tag.Name); } model.BlogTags = model.BlogTags.OrderBy(x => x).ToList(); model.Tags = string.Join(", ", model.BlogTags); return(model); }
private BlogManagementListModel ConvertToListModel(List <BlogEntry> blogEntries) { var model = new BlogManagementListModel(); foreach (var entry in blogEntries) { model.Items.Add(new BlogManagementEntryItemModel() { BlogEntryId = entry.BlogEntryId, CreateDate = entry.CreateDate, Title = entry.Title, IsLive = entry.IsLive, Key = entry.Key, LiveUrlPath = UrlBuilder.BlogUrlPath(entry.Key, entry.BlogPublishDateTimeUtc), PreviewUrlPath = UrlBuilder.BlogPreviewUrlPath(entry.Key) }); } return(model); }
private SitePageListModel ConvertToListModel(List <SitePage> pages) { var model = new SitePageListModel(); foreach (var page in pages) { model.Items.Add(new SitePageItemModel() { SitePageId = page.SitePageId, CreateDate = page.CreateDate, Title = page.Title, IsLive = page.IsLive, Key = page.Key, LiveUrlPath = UrlBuilder.BlogUrlPath(page.SitePageSection.Key, page.Key), PreviewUrlPath = UrlBuilder.BlogPreviewUrlPath(page.SitePageId), IsIndex = page.IsSectionHomePage }); } return(model); }
private BlogManagementEditModel ToUiEditModel(BlogEntry dbModel) { var model = new BlogManagementEditModel() { Content = dbModel.Content, Title = dbModel.Title, BlogEntryId = dbModel.BlogEntryId, BlogPublishDateTimeUtc = dbModel.BlogPublishDateTimeUtc, IsLive = dbModel.IsLive, LiveUrlPath = UrlBuilder.BlogUrlPath(dbModel.Key, dbModel.BlogPublishDateTimeUtc), PreviewUrlPath = UrlBuilder.BlogPreviewUrlPath(dbModel.Key), MetaDescription = dbModel.MetaDescription }; foreach (var photo in dbModel.Photos.OrderBy(x => x.Rank)) { model.BlogPhotos.Add(new BlogPhotoModel { BlogEntryPhotoId = photo.BlogEntryPhotoId, IsDefault = photo.IsDefault, PhotoUrl = photo.PhotoUrl, PhotoThumbUrl = photo.PhotoThumbUrl, Title = photo.Title, Description = photo.Description }); } foreach (var tagItem in dbModel.BlogEntryTags.OrderBy(x => x.Tag.Name)) { model.BlogTags.Add(tagItem.Tag.Name); } model.BlogTags = model.BlogTags.OrderBy(x => x).ToList(); model.Tags = string.Join(", ", model.BlogTags); return(model); }