Files
mixtape/zero.Web/Controllers/PagesController.cs
T

39 lines
894 B
C#
Raw Normal View History

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)
{
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>
public async Task<IActionResult> GetById([FromQuery] string id) => Edit(await Api.GetById(id));
2020-05-19 15:53:01 +02:00
}
}