add page creation handler?...
This commit is contained in:
@@ -50,15 +50,9 @@ namespace zero.Web.Controllers
|
||||
}
|
||||
|
||||
|
||||
public EditModel<IPage> GetEmpty([FromQuery] string type, [FromQuery] string parent = null)
|
||||
public async Task<EditModel<IPage>> GetEmpty([FromQuery] string type, [FromQuery] string parent = null)
|
||||
{
|
||||
PageType pageType = Api.GetPageType(type);
|
||||
IPage model = Activator.CreateInstance(pageType.ContentType) as IPage;
|
||||
|
||||
model.PageTypeAlias = type;
|
||||
model.ParentId = parent;
|
||||
|
||||
return Edit(model);
|
||||
return Edit(await Api.GetEmpty(type, parent));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using System;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
using zero.Core.Routing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace zero.Web.Controllers
|
||||
{
|
||||
@@ -21,10 +23,7 @@ namespace zero.Web.Controllers
|
||||
|
||||
public override void OnActionExecuting(ActionExecutingContext filterContext)
|
||||
{
|
||||
if (filterContext.RouteData.Values.TryGetValue("zero.app", out object app))
|
||||
{
|
||||
Application = (IApplication)app;
|
||||
}
|
||||
Application = filterContext.HttpContext.RequestServices.GetService<IApplicationContext>()?.App;
|
||||
|
||||
if (filterContext.RouteData.Values.TryGetValue("zero.route", out object route))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user