Animierte Navbar-Anzeige für envelopeDto-Informationen hinzugefügt

This commit is contained in:
Developer 02
2024-04-04 17:35:43 +02:00
parent 29ae546d98
commit cbb03d77ba
9 changed files with 105 additions and 65 deletions

View File

@@ -1,4 +1,5 @@
using EnvelopeGenerator.Application.Contracts;
using EnvelopeGenerator.Common;
using EnvelopeGenerator.Web.Services;
using Microsoft.AspNetCore.Mvc;
@@ -9,17 +10,31 @@ namespace EnvelopeGenerator.Web.Controllers
{
private readonly EnvelopeOldService envelopeService;
private readonly ActionService? actionService;
private readonly IEnvelopeService _envelopeService;
public EnvelopeController(DatabaseService database, EnvelopeOldService envelope, ILogger<EnvelopeController> logger) : base(database, logger)
public EnvelopeController(DatabaseService database, EnvelopeOldService envelope, ILogger<EnvelopeController> logger, IEnvelopeService envService) : base(database, logger)
{
envelopeService = envelope;
actionService = database?.Services?.actionService;
_envelopeService = envService;
}
[HttpGet]
[Route("api/envelope/{envelopeKey}")]
[HttpGet("api/envelope/{envelopeKey}")]
public async Task<IActionResult> Get(string envelopeKey)
{
//_logger.LogInformation($"Loading Envelope by Key [{envelopeKey}]");
//Tuple<string, string> result = Helpers.DecodeEnvelopeReceiverId(envelopeKey);
//var envelopeUuid = result.Item1;
//var receiverSignature = result.Item2;
////var receiverId = receiverModel.GetReceiverIdBySignature(receiverSignature);
////_logger.LogInformation("Resolved receiver signature to receiverId [{0}]", receiverId);
//var envlopeServiceResult = await _envelopeService.ReadByUuidAsync(envelopeUuid, withDocuments:true, withReceivers:true, withHistory:true);
//_logger.LogInformation("Loading envelope..");
try
{
// Validate Envelope Key and load envelope
@@ -40,8 +55,7 @@ namespace EnvelopeGenerator.Web.Controllers
}
}
[HttpPost]
[Route("api/envelope/{envelopeKey}")]
[HttpPost("api/envelope/{envelopeKey}")]
public async Task<IActionResult> Update(string envelopeKey, int index)
{
try

View File

@@ -1,4 +1,6 @@
using EnvelopeGenerator.Common;
using EnvelopeGenerator.Application.Contracts;
using EnvelopeGenerator.Application.Services;
using EnvelopeGenerator.Common;
using EnvelopeGenerator.Web.Models;
using EnvelopeGenerator.Web.Services;
using Microsoft.AspNetCore.Mvc;
@@ -9,24 +11,24 @@ namespace EnvelopeGenerator.Web.Controllers
{
public class HomeController : BaseController
{
private readonly EnvelopeOldService _envelopeService;
private readonly EnvelopeOldService envelopeOldService;
private readonly IConfiguration _config;
private readonly IEnvelopeService _envelopeService;
public HomeController(DatabaseService databaseService, EnvelopeOldService envelopeService, ILogger<HomeController> logger, IConfiguration configuration) : base(databaseService, logger)
public HomeController(DatabaseService databaseService, EnvelopeOldService envelopeOldService, ILogger<HomeController> logger, IConfiguration configuration, IEnvelopeService envelopeService) : base(databaseService, logger)
{
this.envelopeOldService = envelopeOldService;
_envelopeService = envelopeService;
_config = configuration;
}
[HttpGet]
[Route("/")]
[HttpGet("/")]
public IActionResult Index()
{
return View();
}
[HttpPost]
[Route("/")]
[HttpPost("/")]
public IActionResult DebugEnvelopes([FromForm] string password)
{
try
@@ -51,7 +53,7 @@ namespace EnvelopeGenerator.Web.Controllers
return View("Index");
}
List<Envelope> envelopes = _envelopeService.LoadEnvelopes();
List<Envelope> envelopes = envelopeOldService.LoadEnvelopes();
return View(envelopes);
}
@@ -62,11 +64,10 @@ namespace EnvelopeGenerator.Web.Controllers
}
}
[HttpGet]
[Route("/EnvelopeKey/{envelopeReceiverId}")]
[HttpGet("/EnvelopeKey/{envelopeReceiverId}")]
public async Task<IActionResult> ShowEnvelope([FromRoute] string envelopeReceiverId)
{
EnvelopeResponse response = await _envelopeService.LoadEnvelope(envelopeReceiverId);
EnvelopeResponse response = await envelopeOldService.LoadEnvelope(envelopeReceiverId);
if (response.Envelope.UseAccessCode)
{
@@ -88,11 +89,10 @@ namespace EnvelopeGenerator.Web.Controllers
}
}
[HttpPost]
[Route("/EnvelopeKey/{envelopeReceiverId}/Locked")]
[HttpPost("/EnvelopeKey/{envelopeReceiverId}/Locked")]
public async Task<IActionResult> ShowEnvelopePost([FromRoute] string envelopeReceiverId, [FromForm] string access_code)
{
EnvelopeResponse response = await _envelopeService.LoadEnvelope(envelopeReceiverId);
EnvelopeResponse response = await envelopeOldService.LoadEnvelope(envelopeReceiverId);
string accessCode = response.Receiver.AccessCode;
if (string.IsNullOrEmpty(access_code))
@@ -114,18 +114,21 @@ namespace EnvelopeGenerator.Web.Controllers
}
}
[HttpGet]
[Route("/EnvelopeKey/{envelopeReceiverId}/Locked")]
public IActionResult EnvelopeLocked([FromRoute] string envelopeReceiverId)
[HttpGet("/EnvelopeKey/{envelopeReceiverId}/Locked")]
public async Task<IActionResult> EnvelopeLocked([FromRoute] string envelopeReceiverId)
{
Tuple<string, string> decode = Common.Helpers.DecodeEnvelopeReceiverId(envelopeReceiverId);
var envelopeUuid = decode.Item1;
var envlopeServiceResult = await _envelopeService.ReadByUuidAsync(envelopeUuid, withDocuments: true, withReceivers: true, withHistory: true);
ViewData["Envelope"] = envlopeServiceResult.Data;
ViewData["EnvelopeKey"] = envelopeReceiverId;
return View();
}
[HttpGet]
[Route("/EnvelopeKey/{EnvelopeReceiverId}/Success")]
[HttpGet("/EnvelopeKey/{EnvelopeReceiverId}/Success")]
public IActionResult EnvelopeSigned()
{
ViewData["EnvelopeKey"] = HttpContext.Request.RouteValues["EnvelopeReceiverId"];
@@ -133,7 +136,6 @@ namespace EnvelopeGenerator.Web.Controllers
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{

View File

@@ -20,8 +20,21 @@ namespace EnvelopeGenerator.Web.Controllers
}
[HttpGet]
public virtual async Task<IActionResult> GetAll([FromQuery] bool withDocuments = false, [FromQuery] bool withReceivers = false, [FromQuery] bool withHistory = false)
public virtual async Task<IActionResult> GetAll([FromQuery] string? envelopeKey = default, [FromQuery] bool withDocuments = true, [FromQuery] bool withReceivers = true, [FromQuery] bool withHistory = true)
{
if(envelopeKey is not null)
{
Tuple<string, string> decode = Common.Helpers.DecodeEnvelopeReceiverId(envelopeKey);
var envelopeUuid = decode.Item1;
var envlopeServiceResult = await _service.ReadByUuidAsync(envelopeUuid, withDocuments: true, withReceivers: true, withHistory: true);
if (envlopeServiceResult.IsSuccess)
{
return Ok(envlopeServiceResult.Data);
}
return NotFound();
}
var result = await _service.ReadAllWithAsync(documents: withDocuments, receivers: withReceivers, history: withHistory);
if (result.IsSuccess)
{