public static PutHtmlContentRequest ToPutRequest(this GetHtmlContentResponse response) { var model = MapHtmlContentWidgetModel(response); return(new PutHtmlContentRequest { Data = model, Id = response.Data.Id }); }
private static SaveHtmlContentModel MapHtmlContentWidgetModel(GetHtmlContentResponse response) { var model = new SaveHtmlContentModel { Version = response.Data.Version, Name = response.Data.Name, ActivationDate = response.Data.ActivationDate, ExpirationDate = response.Data.ExpirationDate, IsPublished = response.Data.IsPublished, PublishedOn = response.Data.PublishedOn, PublishedByUser = response.Data.PublishedByUser, Html = response.Data.Html, CustomCss = response.Data.CustomCss, UseCustomCss = response.Data.UseCustomCss, CustomJavaScript = response.Data.CustomJavaScript, UseCustomJavaScript = response.Data.UseCustomJavaScript, }; return model; }
private static SaveHtmlContentModel MapHtmlContentWidgetModel(GetHtmlContentResponse response) { var model = new SaveHtmlContentModel { Version = response.Data.Version, Name = response.Data.Name, ActivationDate = response.Data.ActivationDate, ExpirationDate = response.Data.ExpirationDate, IsPublished = response.Data.IsPublished, PublishedOn = response.Data.PublishedOn, PublishedByUser = response.Data.PublishedByUser, Html = response.Data.Html, CustomCss = response.Data.CustomCss, UseCustomCss = response.Data.UseCustomCss, CustomJavaScript = response.Data.CustomJavaScript, UseCustomJavaScript = response.Data.UseCustomJavaScript, ChildContentsOptionValues = response.ChildContentsOptionValues }; return(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; }