create page with specified content type + parent

This commit is contained in:
2020-08-12 14:16:28 +02:00
parent c6a3bee139
commit ec732c1c10
7 changed files with 26 additions and 53 deletions
+7 -1
View File
@@ -5,7 +5,7 @@ using zero.Core.Entities;
namespace zero.Web.Controllers
{
public class PagesController<T> : BackofficeController where T : IPage
public class PagesController<T> : BackofficeController where T : IPage, new()
{
IPagesApi<T> Api;
@@ -23,6 +23,12 @@ namespace zero.Web.Controllers
public async Task<IActionResult> GetById([FromQuery] string id) => Edit(await Api.GetById(id));
public IActionResult GetEmpty(string type, string parent = null) => Edit(new T()
{
PageTypeAlias = type,
ParentId = parent
});
public async Task<IActionResult> Save([FromBody] T model) => Json(await Api.Save(model));