Create new Web Project
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
using DigitalData.Modules.Logging;
|
||||
using EnvelopeGenerator.Common;
|
||||
using EnvelopeGenerator.Web.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using static EnvelopeGenerator.Web.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers
|
||||
{
|
||||
public class EnvelopeController : BaseController
|
||||
{
|
||||
private readonly EnvelopeService envelopeService;
|
||||
|
||||
public EnvelopeController(DatabaseService database, LoggingService logging, EnvelopeService envelope) : base(database, logging)
|
||||
{
|
||||
envelopeService = envelope;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("api/envelope/{envelopeKey}")]
|
||||
public IActionResult Get(string envelopeKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.Info("EnvelopeController/Get");
|
||||
|
||||
// Validate Envelope Key and load envelope
|
||||
envelopeService.EnsureValidEnvelopeKey(envelopeKey);
|
||||
EnvelopeResponse response = envelopeService.LoadEnvelope(envelopeKey);
|
||||
|
||||
return Json(response);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ErrorResponse(e);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/envelope/{envelopeKey}")]
|
||||
public async Task<IActionResult> Update(string envelopeKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.Info("EnvelopeController/Update");
|
||||
|
||||
// Validate Envelope Key and load envelope
|
||||
envelopeService.EnsureValidEnvelopeKey(envelopeKey);
|
||||
EnvelopeResponse response = envelopeService.LoadEnvelope(envelopeKey);
|
||||
|
||||
var Request = ControllerContext.HttpContext.Request;
|
||||
var document = envelopeService.GetDocument(Request, envelopeKey);
|
||||
|
||||
string annotationData = await envelopeService.EnsureValidAnnotationData(Request);
|
||||
|
||||
envelopeService.InsertDocumentStatus(new DocumentStatus()
|
||||
{
|
||||
EnvelopeId = response.Envelope.Id,
|
||||
ReceiverId = response.Receiver.Id,
|
||||
Value = annotationData,
|
||||
Status = Common.Constants.DocumentStatus.Signed
|
||||
});
|
||||
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ErrorResponse(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user