using EnotaryoPH.Data.Entities; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; namespace EnotaryoPH.Web.Common.Models { public class IdentificationDocumentModel { public IdentificationDocumentModel() { } public IdentificationDocumentModel(IdentificationDocument document) { using var stream = new MemoryStream(document.File); File = new FormFile(stream, 0, stream.Length, document.Filename, document.Filename); ExpirationDate = document.ExpirationDate; DateIssued = document.DateIssued; PlaceIssued = document.PlaceIssued; IdNumber = document.IdNumber; Filename = document.Filename; ImageBase64Url = File.ToBase64StringUrl(); IdentificationType = document.Type; IdentificationDocument_UID = document.IdentificationDocument_UID.GetValueOrDefault(); } [BindProperty] public DateTime? DateIssued { get; set; } [BindProperty] public DateTime? ExpirationDate { get; set; } [BindProperty] public IFormFile? File { get; set; } [BindProperty] public string Filename { get; set; } [BindProperty] public string IdentificationType { get; set; } public List? IdentificationTypes { get; set; } [BindProperty] public string IdNumber { get; set; } [BindProperty] public string? ImageBase64Url { get; set; } [BindProperty] public string PlaceIssued { get; set; } [BindProperty] public Guid IdentificationDocument_UID { get; set; } } }