Files
fs-onboarding/FoodsharingSiegen.Server/Dialogs/ViewImagesDialog.razor.cs
a.beging@eas-solutions.de b3212acf6d
All checks were successful
Build And Push Dev Docker Image / docker (push) Successful in 2m2s
Implement identity verification feature with image upload and token management
2026-04-20 15:54:17 +02:00

51 lines
1.7 KiB
C#

using Blazorise;
using FoodsharingSiegen.Contracts.Entity;
using FoodsharingSiegen.Server.BaseClasses;
using FoodsharingSiegen.Server.Data.Service;
using Microsoft.AspNetCore.Components;
namespace FoodsharingSiegen.Server.Dialogs
{
public partial class ViewImagesDialog : FsBase
{
[Inject]
public ProspectService ProspectService { get; set; } = null!;
[Parameter]
public Prospect? Prospect { get; set; }
private bool _isLoading = true;
private List<string> _images = new();
private int? SelectedImageIndex { get; set; }
protected override async Task OnInitializedAsync()
{
if (Prospect != null)
{
var result = await ProspectService.GetVerificationImagesAsync(Prospect.Id);
if (result.Success && result.Data != null)
{
foreach (var image in result.Data)
{
var base64 = Convert.ToBase64String(image.ImageData);
var imgSrc = $"data:{image.ContentType};base64,{base64}";
_images.Add(imgSrc);
}
}
}
_isLoading = false;
}
public static async Task ShowAsync(IModalService modalService, Prospect prospect)
{
var title = $"Bilder für {prospect.Name}";
var action = new Action<ModalProviderParameterBuilder<ViewImagesDialog>>(b =>
{
b.Add(nameof(Prospect), prospect);
});
await modalService.Show(title, action, new ModalInstanceOptions { Size = ModalSize.ExtraLarge });
}
}
}