Alle Entitäten wurden mit Attributen erstellt und zu EFCore DBContex hinzugefügt.

This commit is contained in:
Developer 02
2024-04-02 14:53:25 +02:00
parent 6fc210132d
commit b65766ce24
30 changed files with 772 additions and 269 deletions

View File

@@ -10,10 +10,12 @@ namespace EnvelopeGenerator.Web.Controllers
public class HomeController : BaseController
{
private readonly EnvelopeService _envelopeService;
private readonly IConfiguration _config;
public HomeController(DatabaseService databaseService, LoggingService loggingService, EnvelopeService envelopeService): base(databaseService, loggingService)
public HomeController(DatabaseService databaseService, EnvelopeService envelopeService, ILogger<HomeController> logger, IConfiguration configuration) : base(databaseService, logger)
{
_envelopeService = envelopeService;
_config = configuration;
}
[HttpGet]
@@ -25,12 +27,11 @@ namespace EnvelopeGenerator.Web.Controllers
[HttpPost]
[Route("/")]
public IActionResult DebugEnvelopes()
public IActionResult DebugEnvelopes([FromForm] string password)
{
try
{
StringValues passwordFromForm = HttpContext.Request.Form["password"];
string passwordFromConfig = database.GetAppSetting("Config:AdminPassword");
var passwordFromConfig = _config["Config:AdminPassword"] ?? throw new InvalidOperationException("No admin password configured!");
if (passwordFromConfig == null)
{
@@ -38,14 +39,6 @@ namespace EnvelopeGenerator.Web.Controllers
return View("Index");
}
if (passwordFromForm.Count != 1)
{
ViewData["error"] = "No admin password configured!";
return View("Index");
}
string password = passwordFromForm[0];
if (password == null)
{
ViewData["error"] = "No password supplied!";
@@ -107,7 +100,7 @@ namespace EnvelopeGenerator.Web.Controllers
return Redirect($"/EnvelopeKey/{envelopeReceiverId}/Locked");
}
if (accessCode.Equals(access_code, StringComparison.Ordinal))
if (accessCode == access_code)
{
bool actionResult = database.Services.actionService.EnterCorrectAccessCode(response.Envelope, response.Receiver);
ViewData["EnvelopeKey"] = envelopeReceiverId;