Fixed a bunch of warnings

This commit is contained in:
Andre Beging
2022-05-31 15:08:55 +02:00
parent cd22c2f215
commit 7208f1e86d
21 changed files with 202 additions and 140 deletions

View File

@@ -18,8 +18,8 @@ namespace FoodsharingSiegen.Server.Dialogs
public Guid SelectedUser { get; set; }
private string _header;
private string _infoName;
private string? _header;
private string? _infoName;
private bool _showInfo;
private bool _showAlert;
private bool _showNotNeeded;

View File

@@ -4,9 +4,9 @@
private Prospect Prospect { get; set; } = new();
private string Header { get; set; }
private string? Header { get; set; }
private string SaveButtonText { get; set; }
private string? SaveButtonText { get; set; }
private bool IsUpdateMode { get; set; }
@@ -16,14 +16,15 @@
public async Task Show()
{
Prospect = new();
Prospect = new Prospect();
Header = "Neuling hinzufügen";
SaveButtonText = "Hinzufügen";
await ModalReference.Show();
}
public async Task Show(Prospect prospect)
public async Task Show(Prospect? prospect)
{
if (prospect == null) return;
Prospect = prospect;
IsUpdateMode = true;
Header = $"{Prospect.Name} bearbeiten";

View File

@@ -7,8 +7,8 @@
private User User { get; set; } = new();
private string Password { get; set; }
private string ConfirmPassword { get; set; }
private string? Password { get; set; }
private string? ConfirmPassword { get; set; }
[Parameter]
public EventCallback<User> OnPasswortSet { get; set; }
@@ -34,7 +34,7 @@
private async Task SaveClick(object arg)
{
User.Password = Password;
User.Password = Password ?? string.Empty;
await OnPasswortSet.InvokeAsync(User);
await ModalReference.Hide();
}
@@ -51,19 +51,19 @@
<Field>
<FieldLabel>Passwort</FieldLabel>
<Validation Validator="ValidationHelper.ValidatePassword" @bind-Status="@IsValidPassword">
<TextEdit @bind-Text="Password" Role="TextRole.Password" Placeholder="Passwort"></TextEdit>
<TextEdit @bind-Text="Password" Placeholder="Passwort" Role="TextRole.Password"></TextEdit>
</Validation>
</Field>
<Field>
<FieldLabel>Passwort wiederholen</FieldLabel>
<Validation Validator="ValidationHelper.ValidatePassword" @bind-Status="@IsValidConfirm">
<TextEdit @bind-Text="ConfirmPassword" Role="TextRole.Password" Placeholder="Passwort"></TextEdit>
<TextEdit @bind-Text="ConfirmPassword" Placeholder="Passwort" Role="TextRole.Password"></TextEdit>
</Validation>
</Field>
</ModalBody>
<ModalFooter>
<Button Color="Color.Secondary" Clicked="ModalReference.Hide">Abbrechen</Button>
<Button Color="Color.Primary" Clicked="SaveClick" Disabled="@SaveDisabled">Speichern</Button>
<Button Clicked="ModalReference.Hide" Color="Color.Secondary">Abbrechen</Button>
<Button Clicked="SaveClick" Color="Color.Primary" Disabled="@SaveDisabled">Speichern</Button>
</ModalFooter>
</ModalContent>
</Modal>