first draft of setup works now

This commit is contained in:
2020-04-04 19:31:01 +02:00
parent 0ed7090669
commit 3fadbe2177
5 changed files with 55 additions and 7 deletions
+13 -1
View File
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Linq;
@@ -7,6 +8,7 @@ using zero.Core;
using zero.Core.Api;
using zero.Core.Entities;
using zero.Core.Entities.Setup;
using zero.Core.Extensions;
using zero.Web.Controllers;
namespace zero.Web.Setup
@@ -16,20 +18,30 @@ namespace zero.Web.Setup
{
protected ISetupApi Api { get; private set; }
protected IWebHostEnvironment Environment { get; private set; }
public SetupController(IZeroConfiguration config, ISetupApi api) : base(config)
public SetupController(IZeroConfiguration config, ISetupApi api, IWebHostEnvironment env) : base(config)
{
Api = api;
Environment = env;
}
public IActionResult Index()
{
if (!Configuration.ZeroVersion.IsNullOrEmpty())
{
return RedirectToAction("Index", "Index");
}
return View("/Views/Setup.cshtml");
}
[HttpPost]
public async Task<IActionResult> Install([FromBody] SetupModel model)
{
model.ContentRootPath = Environment.ContentRootPath;
EntityChangeResult<SetupModel> result = await Api.Install(model);
if (result.IsSuccess)