2020-05-19 15:53:01 +02:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using zero.Core.Api;
|
2020-05-25 11:27:23 +02:00
|
|
|
using zero.Core.Entities;
|
2020-05-19 15:53:01 +02:00
|
|
|
|
|
|
|
|
namespace zero.Web.Controllers
|
|
|
|
|
{
|
2020-05-25 11:27:23 +02:00
|
|
|
public class PagesController<T> : BackofficeController where T : IPage
|
2020-05-19 15:53:01 +02:00
|
|
|
{
|
2020-05-25 11:27:23 +02:00
|
|
|
IPagesApi<T> Api;
|
2020-05-19 15:53:01 +02:00
|
|
|
|
2020-05-25 11:27:23 +02:00
|
|
|
public PagesController(IPagesApi<T> api)
|
2020-05-19 15:53:01 +02:00
|
|
|
{
|
|
|
|
|
Api = api;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get all page types which are allowed below a selected parent page
|
|
|
|
|
/// </summary>
|
|
|
|
|
public async Task<ActionResult> GetAllowedPageTypes([FromQuery] string parent = null)
|
|
|
|
|
{
|
2020-05-22 15:06:17 +02:00
|
|
|
return Json(await Api.GetAllowedPageTypes(parent));
|
2020-05-19 15:53:01 +02:00
|
|
|
}
|
2020-05-25 11:27:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get translation by id
|
|
|
|
|
/// </summary>
|
|
|
|
|
//public IActionResult GetEmpty() => JsonEdit(new T());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get page by id
|
|
|
|
|
/// </summary>
|
2020-06-03 12:57:29 +02:00
|
|
|
public async Task<IActionResult> GetById([FromQuery] string id) => Edit(await Api.GetById(id));
|
2020-05-19 15:53:01 +02:00
|
|
|
}
|
|
|
|
|
}
|