/// <summary> /// Gets the HTML content widgets. /// </summary> /// <param name="request">The request.</param> /// <returns> /// HTML content widget list. /// </returns> /// <exception cref="CmsApiException">Failed to get widgets.</exception> public DataListResponse <HtmlContentWidget> GetHtmlContentWidgets(GetHtmlContentWidgetsRequest request) { try { return(Repository.ToDataListResponse(request)); } catch (Exception inner) { var message = string.Format("Failed to get HTML content widgets."); Logger.Error(message, inner); throw new CmsApiException(message, inner); } }
private static HtmlContentWidget AddHtmlWidget(PagesApiContext pagesApi, string title, string html) { var name = string.Format("Default Better CMS {0}", title); var getRequest = new GetHtmlContentWidgetsRequest(e => e.Name == name); var widgets = pagesApi.GetHtmlContentWidgets(getRequest); if (widgets.Items.Count > 0) { return(widgets.Items[0]); } var createRequest = new CreateHtmlContentWidgetRequest { Name = name, Html = html }; return(pagesApi.CreateHtmlContentWidget(createRequest)); }
private static HtmlContentWidget AddHtmlWidget(PagesApiContext pagesApi, string title, string html) { var name = string.Format("Default Better CMS {0}", title); var getRequest = new GetHtmlContentWidgetsRequest(e => e.Name == name); var widgets = pagesApi.GetHtmlContentWidgets(getRequest); if (widgets.Items.Count > 0) { return widgets.Items[0]; } var createRequest = new CreateHtmlContentWidgetRequest { Name = name, Html = html }; return pagesApi.CreateHtmlContentWidget(createRequest); }
/// <summary> /// Gets the HTML content widgets. /// </summary> /// <param name="request">The request.</param> /// <returns> /// HTML content widget list. /// </returns> /// <exception cref="CmsApiException">Failed to get widgets.</exception> public DataListResponse<HtmlContentWidget> GetHtmlContentWidgets(GetHtmlContentWidgetsRequest request) { try { return Repository.ToDataListResponse(request); } catch (Exception inner) { var message = string.Format("Failed to get HTML content widgets."); Logger.Error(message, inner); throw new CmsApiException(message, inner); } }