using EnotaryoPH.Data; using EnotaryoPH.Web.Common.Models; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; namespace EnotaryoPH.Web.Pages.Principal.NotaryoSteps { public class UploadIdentificationModel : BaseIdentificationDocumentPageModel { private readonly ICurrentUserService _currentUserService; public UploadIdentificationModel(NotaryoDBContext notaryoDBContext, ICurrentUserService currentUserService) : base(notaryoDBContext) => _currentUserService = currentUserService; public void OnGetAsync() { } public async Task OnPostAsync() { if (UploadNewIdentification) { if (!ModelState.IsValid) { NewIdentificationDocument = new IdentificationDocumentModel { IdentificationTypes = GetIdentificationDocumentTypes() }; return Page(); } CreateIdentificationDocument(_currentUserService.GetUser_UID()); } return RedirectToPage("/Principal/NotaryoSteps/TakeSelfie"); } private List GetIdentificationDocumentTypes() { var lookupIdentificationTypes = _notaryoDBContext.LookupData.AsNoTracking().Include(e => e.LookupDataValues).FirstOrDefault(e => e.Name == "Identification Types"); return lookupIdentificationTypes.LookupDataValues .ConvertAll(m => new SelectListItem { Text = m.Title.DefaultIfEmpty(m.Value), Value = m.Value }); } public int ExistingIdentificationDocumentCount => ExistingIdentificationDocuments.Count; public List ExistingIdentificationDocuments { get; set; } = []; public Guid Transaction_UID { get; private set; } } }