public async Task <IActionResult> PageUpdate([FromBody] CmsPostWebHookApiModel model) { if (model == null) { return(BadRequest("delete model empty or null.")); } var postId = model.post_id; if (postId <= 0) { return(BadRequest($"post id null. model.post_id: {postId}")); } var webHookTypeName = HeaderType(); if (string.IsNullOrEmpty(webHookTypeName) || webHookTypeName != "post_update") { return(BadRequest("no webhook name provided.")); } var apiPath = model.post.post_type; _cmsApiProxy.RemovePageCache(postId); _cmsApiProxy.RemovePagesCache(apiPath); await _cmsApiProxy.GetPage(postId, apiPath); await _cmsApiProxy.GetPages(regionPageApiPath : apiPath); _logger.LogInformation("Cleared and renewed cache for page {PageId} for page api path {ApiPath}.", postId, apiPath); return(Ok()); }
public async Task <IActionResult> Index() { var page = await _cmsApiProxy.GetPage(_pageId, _regionValue.PagesApiUrl); var model = new CalendarViewModel { Title = page.Title.Rendered }; return(View(model)); }
public async Task <IActionResult> Index() { var page = await _cmsApiProxy.GetPage(_pageId, _regionValue.PagesApiUrl); var htmlBody = StringHelper.SanitizeHtml(page.Content?.Rendered, _cmsDomain); var model = new FullPageViewModel { Header = page.Title.Rendered, HtmlBody = htmlBody, Ogp = new OgpViewModel { Title = page.Title.Rendered, Description = page.Title.Rendered, Type = "website", Url = Request.GetDisplayUrl() } }; return(View(model)); }