delete button and OnGetViewImage

This commit is contained in:
jojo aquino 2024-12-27 07:32:08 +00:00
parent 9fd1be46bc
commit 76270239a0
2 changed files with 27 additions and 1 deletions

View File

@ -11,10 +11,17 @@
<form method="post" enctype="multipart/form-data">
@Html.EditorFor(m => m.IdentificationDocument)
<div class="mt-4">
<button type="submit" class="btn btn-primary btn-lg" role="button">
<button type="submit" class="btn btn-primary btn-lg">
<i class="far fa-save me-2"></i>
SAVE
</button>
@if (Model.IdentificationDocument_UID != Guid.Empty)
{
<button type="button" class="btn btn-danger btn-lg identificationdocument__delete__button">
<i class="fa fa-times me-2"></i>
DELETE
</button>
}
</div>
</form>
</div>
@ -23,6 +30,7 @@
@section Scripts {
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<partial name="_ValidationScriptsPartial" />
<script src="~/dist/js/jfa.min.js"></script>
<script src="~/js/identification-document.js"></script>
}

View File

@ -1,5 +1,6 @@
using EnotaryoPH.Data;
using EnotaryoPH.Web.Common.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
@ -104,6 +105,23 @@ namespace EnotaryoPH.Web.Pages.Principal.IdentificationDocument
return new OkObjectResult(true);
}
[AllowAnonymous]
public IActionResult OnGetViewImage()
{
if (IdentificationDocument_UID == Guid.Empty)
{
return NotFound();
}
var identificationDocument = _notaryoDBContext.IdentificationDocuments.FirstOrDefault(e => e.IdentificationDocument_UID == IdentificationDocument_UID);
if (identificationDocument == null)
{
return NotFound();
}
return File(identificationDocument.File, "image/jpg");
}
private void LoadIdentificationDocumentTypes()
{
var lookupIdentificationTypes = _notaryoDBContext.LookupData.AsNoTracking().Include(e => e.LookupDataValues).FirstOrDefault(e => e.Name == "Identification Types");