mirror of https://github.com/abpframework/abp.git
5 changed files with 43 additions and 51 deletions
@ -0,0 +1,34 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc.ActionConstraints; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.CmsKit.Public.Pages; |
|||
|
|||
namespace Volo.CmsKit.Public.Web.Controllers |
|||
{ |
|||
public class PageController : CmsKitPublicControllerBase |
|||
{ |
|||
protected IPageAppService PageAppService { get; } |
|||
|
|||
public PageController(IPageAppService pageAppService) |
|||
{ |
|||
PageAppService = pageAppService; |
|||
} |
|||
|
|||
[HttpGet("/{*url}", Order = int.MaxValue)] |
|||
public async Task<IActionResult> IndexAsync(string url) |
|||
{ |
|||
var page = await PageAppService.FindByUrlAsync(url); |
|||
|
|||
if (page == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return View("~/Views/Page/Index.cshtml", page); |
|||
} |
|||
} |
|||
} |
|||
@ -1,13 +0,0 @@ |
|||
@page "{*pageUrl}" |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@using Volo.CmsKit.Localization |
|||
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages |
|||
@model Volo.CmsKit.Public.Web.Pages.CmsKit.Pages.IndexModel |
|||
@inject IHtmlLocalizer<CmsKitResource> L |
|||
|
|||
@await Component.InvokeAsync(typeof(DefaultPageViewComponent), |
|||
new |
|||
{ |
|||
pageId = Model.Page.Id, |
|||
title = Model.Page.Title |
|||
}) |
|||
@ -1,34 +0,0 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.CmsKit.Public.Pages; |
|||
using Volo.CmsKit.Web.Pages; |
|||
|
|||
namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Pages |
|||
{ |
|||
public class IndexModel : CommonPageModel |
|||
{ |
|||
[BindProperty(SupportsGet = true)] |
|||
public string PageUrl { get; set; } |
|||
|
|||
protected readonly IPageAppService PageAppService; |
|||
|
|||
public PageDto Page; |
|||
|
|||
public IndexModel(IPageAppService pageAppService) |
|||
{ |
|||
PageAppService = pageAppService; |
|||
} |
|||
|
|||
public async Task<IActionResult> OnGetAsync() |
|||
{ |
|||
Page = await PageAppService.FindByUrlAsync(PageUrl); |
|||
|
|||
if (Page == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return Page(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
@model Volo.CmsKit.Public.Pages.PageDto |
|||
|
|||
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages |
|||
|
|||
@await Component.InvokeAsync(typeof(DefaultPageViewComponent), new |
|||
{ |
|||
pageId = Model.Id, |
|||
title = Model.Title |
|||
}) |
|||
Loading…
Reference in new issue