public IActionResult Index() { var contentPage = WorkContext.FindContentPageByName("index"); if (contentPage != null) { WorkContext.SetCurrentPage(contentPage); return(View(contentPage.Template, WorkContext)); } return(View("index")); }
public async Task <ActionResult> GetBlog(string blog = null, string category = null, string tag = null, int pageNumber = 1) { var context = WorkContext; context.CurrentBlog = WorkContext.Blogs.FirstOrDefault(); if (!string.IsNullOrEmpty(blog)) { context.CurrentBlog = WorkContext.Blogs.FirstOrDefault(x => x.Name.EqualsInvariant(blog)); } WorkContext.CurrentBlogSearchCritera.Category = category; WorkContext.CurrentBlogSearchCritera.Tag = tag; WorkContext.PageNumber = pageNumber; if (context.CurrentBlog != null) { var authorizationResult = await _authorizationService.AuthorizeAsync(User, context.CurrentBlog, "CanReadContentItem"); if (!authorizationResult.Succeeded) { return(Challenge()); } context.CurrentPageSeo = new SeoInfo { Language = context.CurrentBlog.Language, MetaDescription = context.CurrentBlog.Title ?? context.CurrentBlog.Name, Title = context.CurrentBlog.Title ?? context.CurrentBlog.Name, Slug = context.RequestUrl.AbsolutePath }; WorkContext.Layout = WorkContext.CurrentBlog.Layout; var contentPage = WorkContext.FindContentPageByName("blog"); if (contentPage != null) { WorkContext.SetCurrentPage(contentPage); return(View(contentPage.Template, WorkContext)); } return(View("blog", WorkContext)); } return(NotFound()); }