refactor(HomeController): Aktualisiert, um ein Dokument aus der Datenbank über EnvelopeDocumentDto zu lesen, anstatt das Dokument aus dem Dateipfad mit envelopeOldService zu lesen
This commit is contained in:
parent
084a9b7db4
commit
6ccc0d2e0a
@ -17,6 +17,7 @@ using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
using Ganss.Xss;
|
||||
using Newtonsoft.Json;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers
|
||||
{
|
||||
@ -188,15 +189,13 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
if (await _historyService.IsSigned(envelopeId: er.Envelope!.Id, userReference: er.Receiver!.EmailAddress))
|
||||
return View("EnvelopeSigned");
|
||||
|
||||
if (response.Envelope.Documents.Count > 0)
|
||||
if (er.Envelope.Documents?.FirstOrDefault() is EnvelopeDocumentDto doc && doc.ByteData is not null)
|
||||
{
|
||||
var document = await envelopeOldService.GetDocument(response.Envelope.Documents[0].Id, envelopeReceiverId);
|
||||
byte[] bytes = await envelopeOldService.GetDocumentContents(document);
|
||||
ViewData["DocumentBytes"] = bytes;
|
||||
ViewData["DocumentBytes"] = doc.ByteData;
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogEnvelopeError(envelopeReceiverId: envelopeReceiverId, message: "No document was found.");
|
||||
_logger.LogEnvelopeError(envelopeReceiverId: envelopeReceiverId, message: "No document byte-data was found in ENVELOPE_DOCUMENT table.");
|
||||
return this.ViewDocumentNotFound();
|
||||
}
|
||||
|
||||
@ -351,12 +350,10 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
_logger.LogNotice(hist_res.Notices);
|
||||
}
|
||||
|
||||
if (response.Envelope.Documents.Count > 0)
|
||||
if (er.Envelope.Documents?.FirstOrDefault() is EnvelopeDocumentDto doc && doc.ByteData is not null)
|
||||
{
|
||||
var document = await envelopeOldService.GetDocument(response.Envelope.Documents[0].Id, envelopeKey);
|
||||
byte[] bytes = await envelopeOldService.GetDocumentContents(document);
|
||||
ViewData["DocumentBytes"] = doc.ByteData;
|
||||
ViewData["EnvelopeKey"] = envelopeKey;
|
||||
ViewData["DocumentBytes"] = bytes;
|
||||
ViewData["IsReadOnly"] = true;
|
||||
ViewData["ReadOnly"] = erro;
|
||||
ViewData["PSPDFKitLicenseKey"] = _configuration["PSPDFKitLicenseKey"];
|
||||
@ -364,7 +361,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogEnvelopeError(envelopeReceiverId: envelopeKey, message: "No document was found.");
|
||||
_logger.LogEnvelopeError(envelopeReceiverId: envelopeKey, message: "No document byte-data was found in ENVELOPE_DOCUMENT table.");
|
||||
return this.ViewDocumentNotFound();
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user