inherit from BaseIdentificationDocumentPageModel
This commit is contained in:
parent
3cfb4673b5
commit
ab9f7df310
@ -1,39 +1,19 @@
|
|||||||
using EnotaryoPH.Data;
|
using EnotaryoPH.Data;
|
||||||
using EnotaryoPH.Web.Common.Models;
|
using EnotaryoPH.Web.Common.Models;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
|
|
||||||
namespace EnotaryoPH.Web.Pages.Principal.NotaryoSteps
|
namespace EnotaryoPH.Web.Pages.Principal.NotaryoSteps
|
||||||
{
|
{
|
||||||
public class UploadIdentificationModel : PageModel
|
public class UploadIdentificationModel : BaseIdentificationDocumentPageModel
|
||||||
{
|
{
|
||||||
private readonly ICurrentUserService _currentUserService;
|
private readonly ICurrentUserService _currentUserService;
|
||||||
private readonly NotaryoDBContext _notaryoDBContext;
|
|
||||||
|
|
||||||
public UploadIdentificationModel(NotaryoDBContext notaryoDBContext, ICurrentUserService currentUserService)
|
public UploadIdentificationModel(NotaryoDBContext notaryoDBContext, ICurrentUserService currentUserService)
|
||||||
|
: base(notaryoDBContext) => _currentUserService = currentUserService;
|
||||||
|
|
||||||
|
public void OnGetAsync()
|
||||||
{
|
{
|
||||||
_notaryoDBContext = notaryoDBContext;
|
|
||||||
_currentUserService = currentUserService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IActionResult> OnGetAsync()
|
|
||||||
{
|
|
||||||
var user = _notaryoDBContext.Users.AsNoTracking().FirstOrDefault(u => u.User_UID == _currentUserService.GetUser_UID());
|
|
||||||
if (user == null)
|
|
||||||
{
|
|
||||||
return BadRequest();
|
|
||||||
}
|
|
||||||
ExistingIdentificationDocuments = GetIdentityDocumentsByUserID(user.UserID);
|
|
||||||
|
|
||||||
NewIdentificationDocument = new IdentificationDocumentModel
|
|
||||||
{
|
|
||||||
IdentificationTypes = GetIdentificationDocumentTypes()
|
|
||||||
};
|
|
||||||
|
|
||||||
UploadNewIdentification = true;
|
|
||||||
|
|
||||||
return Page();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostAsync()
|
public async Task<IActionResult> OnPostAsync()
|
||||||
@ -48,6 +28,8 @@ namespace EnotaryoPH.Web.Pages.Principal.NotaryoSteps
|
|||||||
};
|
};
|
||||||
return Page();
|
return Page();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CreateIdentificationDocument(_currentUserService.GetUser_UID());
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToPage("/Principal/NotaryoSteps/TakeSelfie");
|
return RedirectToPage("/Principal/NotaryoSteps/TakeSelfie");
|
||||||
@ -64,24 +46,10 @@ namespace EnotaryoPH.Web.Pages.Principal.NotaryoSteps
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<IdentificationDocumentModel> GetIdentityDocumentsByUserID(int userID) =>
|
|
||||||
_notaryoDBContext.IdentificationDocuments.AsNoTracking()
|
|
||||||
.Where(d => d.UserID == userID)
|
|
||||||
.Select(d => new IdentificationDocumentModel(d)).ToList();
|
|
||||||
|
|
||||||
public int ExistingIdentificationDocumentCount => ExistingIdentificationDocuments.Count;
|
public int ExistingIdentificationDocumentCount => ExistingIdentificationDocuments.Count;
|
||||||
|
|
||||||
public List<IdentificationDocumentModel> ExistingIdentificationDocuments { get; set; } = [];
|
public List<IdentificationDocumentModel> ExistingIdentificationDocuments { get; set; } = [];
|
||||||
|
|
||||||
[BindProperty(SupportsGet = true)]
|
|
||||||
public Guid IdentificationDocument_UID { get; set; }
|
|
||||||
|
|
||||||
[BindProperty]
|
|
||||||
public IdentificationDocumentModel NewIdentificationDocument { get; set; }
|
|
||||||
|
|
||||||
[BindProperty]
|
|
||||||
public bool UploadNewIdentification { get; set; }
|
|
||||||
|
|
||||||
public Guid Transaction_UID { get; private set; }
|
public Guid Transaction_UID { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user