public GetHtmlContentResponse Get(GetHtmlContentRequest request) { var model = repository .AsQueryable <Module.Pages.Models.HtmlContent>(content => content.Id == request.ContentId) .Select(content => new HtmlContentModel { Id = content.Id, Version = content.Version, CreatedBy = content.CreatedByUser, CreatedOn = content.CreatedOn, LastModifiedBy = content.ModifiedByUser, LastModifiedOn = content.ModifiedOn, Name = content.Name, ActivationDate = content.ActivationDate, ExpirationDate = content.ExpirationDate, Html = content.Html, CustomCss = content.CustomCss, UseCustomCss = content.UseCustomCss, CustomJavaScript = content.CustomJs, UseCustomJavaScript = content.UseCustomJs, IsPublished = content.Status == ContentStatus.Published, PublishedByUser = content.Status == ContentStatus.Published ? content.PublishedByUser : null, PublishedOn = content.Status == ContentStatus.Published ? content.PublishedOn : null }) .FirstOne(); return(new GetHtmlContentResponse { Data = model }); }
/// <summary> /// Gets the specified html content. /// </summary> /// <param name="request">The request.</param> /// <returns> /// <c>GetHtmlContentResponse</c> with html content. /// </returns> public GetHtmlContentResponse Get(GetHtmlContentRequest request) { var model = repository .AsQueryable <Module.Pages.Models.HtmlContent>(content => content.Id == request.ContentId) .Select(content => new HtmlContentModel { Id = content.Id, Version = content.Version, CreatedBy = content.CreatedByUser, CreatedOn = content.CreatedOn, LastModifiedBy = content.ModifiedByUser, LastModifiedOn = content.ModifiedOn, Name = content.Name, ActivationDate = content.ActivationDate, ExpirationDate = content.ExpirationDate, Html = content.Html, OriginalText = content.OriginalText, ContentTextMode = (ContentTextMode)content.ContentTextMode, CustomCss = content.CustomCss, UseCustomCss = content.UseCustomCss, CustomJavaScript = content.CustomJs, UseCustomJavaScript = content.UseCustomJs, IsPublished = content.Status == ContentStatus.Published, PublishedByUser = content.Status == ContentStatus.Published ? content.PublishedByUser : null, PublishedOn = content.Status == ContentStatus.Published ? content.PublishedOn : null }) .FirstOne(); var response = new GetHtmlContentResponse { Data = model }; if (request.Data.IncludeChildContentsOptions) { response.ChildContentsOptionValues = optionService .GetChildContentsOptionValues(request.ContentId) .ToServiceModel(); } return(response); }