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

36 lines
796 B
C#
Raw Normal View History

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
2020-03-30 17:11:56 +02:00
using System.Threading.Tasks;
using zero.Core;
2020-04-03 16:45:47 +02:00
using zero.Core.Api;
using zero.Core.Entities;
2020-03-30 17:11:56 +02:00
using zero.Core.Entities.Setup;
using zero.Web.Controllers;
namespace zero.Web.Setup
{
[AllowAnonymous]
public class SetupController : BackofficeController
{
2020-04-03 16:45:47 +02:00
protected ISetupApi Api { get; private set; }
2020-04-03 16:45:47 +02:00
public SetupController(IZeroConfiguration config, ISetupApi api) : base(config)
{
Api = api;
}
public IActionResult Index()
{
2020-03-26 22:14:16 +01:00
return View("/Views/Setup.cshtml");
}
2020-03-30 17:11:56 +02:00
[HttpPost]
2020-04-03 16:45:47 +02:00
public async Task<IActionResult> Install([FromBody] SetupModel model)
2020-03-30 17:11:56 +02:00
{
2020-04-03 16:45:47 +02:00
EntityChangeResult<SetupModel> result = await Api.Install(model);
return Json(result);
2020-03-30 17:11:56 +02:00
}
}
}