mirror of https://github.com/abpframework/abp.git
5 changed files with 51 additions and 46 deletions
@ -1,37 +0,0 @@ |
|||||
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.Abp.GlobalFeatures; |
|
||||
using Volo.CmsKit.GlobalFeatures; |
|
||||
using Volo.CmsKit.Public.Pages; |
|
||||
|
|
||||
namespace Volo.CmsKit.Public.Web.Controllers |
|
||||
{ |
|
||||
[RequiresGlobalFeature(typeof(PagesFeature))] |
|
||||
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); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,13 @@ |
|||||
|
@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 |
||||
|
}) |
||||
@ -0,0 +1,34 @@ |
|||||
|
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(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,9 +0,0 @@ |
|||||
@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