Code-Style: DRO: Validate Profile erst in SendResponse machen

This commit is contained in:
2025-11-20 11:34:24 +01:00
parent 7929f0bed6
commit 1359aee2b1

View File

@ -82,6 +82,7 @@
private async Task SendResponse(bool response) private async Task SendResponse(bool response)
{ {
if(ValidateProfiles()) {
if(_response == null) if(_response == null)
{ {
_response = new Response(); _response = new Response();
@ -96,13 +97,6 @@
_response = await EventRegistrationService.UpdateResponseAsync(_response); _response = await EventRegistrationService.UpdateResponseAsync(_response);
} }
if(_response != null) Status = _response.ResponseType; if(_response != null) Status = _response.ResponseType;
}
private async void Zusage()
{
if(ValidateProfiles())
{
await SendResponse(true);
} else } else
{ {
var currentPathAndQuery = new Uri(NavigationManager.Uri).PathAndQuery; var currentPathAndQuery = new Uri(NavigationManager.Uri).PathAndQuery;
@ -113,19 +107,14 @@
} }
} }
private async void Zusage()
{
await SendResponse(true);
}
private async void Absage() private async void Absage()
{ {
if(ValidateProfiles())
{
await SendResponse(false); await SendResponse(false);
} else
{
var currentPathAndQuery = new Uri(NavigationManager.Uri).PathAndQuery;
var encodedReturnUrl = Uri.EscapeDataString(currentPathAndQuery);
var link = $"/profile?tab=profile&returnurl={encodedReturnUrl}";
AddModuleMessage(string.Format(SharedLocalizer["ProfileRequired"], $"Vervollständige hier dein Profil mit deinem Jahrgang und deiner Fachrichtung: {link}"), MessageType.Warning);
}
} }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()