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

@@ -1,13 +1,9 @@
@page "/login"
@using FoodsharingSiegen.Server.Auth
@using FoodsharingSiegen.Shared.Helper
@layout LoginLayout
@inherits FoodsharingSiegen.Server.BaseClasses.FsBase
@inject AuthService AuthService
@inject NavigationManager NavigationManager
<div class="d-flex justify-content-center align-items-center" style="height: 100vh;">
<div class="card" style="width: 100%; max-width: 380px;">
<div class="card-header">FS Siegen</div>

View File

@@ -4,33 +4,32 @@ using Microsoft.AspNetCore.Components.Web;
namespace FoodsharingSiegen.Server.Pages
{
/// <summary>
/// The login class (a. beging, 11.04.2022)
/// The login class (a. beging, 11.04.2022)
/// </summary>
public partial class Login
{
#region Public Properties
/// <summary>
/// Gets or sets the value of the is valid mail (ab)
/// </summary>
public ValidationStatus IsValidMail { get; set; }
/// <summary>
/// Gets or sets the value of the is valid password (ab)
/// </summary>
public ValidationStatus IsValidPassword { get; set; }
#endregion
#region Private Properties
/// <summary>
/// Gets or sets the value of the mail-address (ab)
/// Gets or sets the value of the is valid mail (ab)
/// </summary>
private ValidationStatus IsValidMail { get; set; }
/// <summary>
/// Gets or sets the value of the is valid password (ab)
/// </summary>
private ValidationStatus IsValidPassword { get; set; }
/// <summary>
/// Gets or sets the value of the auth service (ab)
/// </summary>
/// <summary>
/// Gets or sets the value of the mail-address (ab)
/// </summary>
private string? MailAddress { get; set; }
/// <summary>
/// Gets or sets the value of the password (ab)
/// Gets or sets the value of the password (ab)
/// </summary>
private string? Password { get; set; }
@@ -39,7 +38,7 @@ namespace FoodsharingSiegen.Server.Pages
#region Private Method PerformLogin
/// <summary>
/// Performs the login (a. beging, 11.04.2022)
/// Performs the login (a. beging, 11.04.2022)
/// </summary>
private async Task PerformLogin()
{
@@ -51,16 +50,12 @@ namespace FoodsharingSiegen.Server.Pages
Password = string.Empty;
return;
}
var loginR = await AuthService.Login(MailAddress, Password);
if (loginR.Success)
{
NavigationManager.NavigateTo("/", true);
}
else
{
await Notification?.Error(loginR.ErrorMessage)!;
}
await Notification.Error(loginR.ErrorMessage)!;
}
#endregion
@@ -68,7 +63,7 @@ namespace FoodsharingSiegen.Server.Pages
#region Private Method TextEdit_KeyUp
/// <summary>
/// Texts the edit key up using the specified arg (a. beging, 11.04.2022)
/// Texts the edit key up using the specified arg (a. beging, 11.04.2022)
/// </summary>
/// <param name="arg">The arg</param>
private async Task TextEdit_KeyUp(KeyboardEventArgs arg)

View File

@@ -28,7 +28,7 @@
<h4>Aktuell:</h4>
<div class="row m-0">
<Repeater Items="@activeProspects">
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="@RemoveInteraction"></ProspectContainer>
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="RemoveInteraction"></ProspectContainer>
</Repeater>
</div>
}
@@ -43,7 +43,7 @@
<h4>Abgeschlossen:</h4>
<div class="row m-0">
<Repeater Items="@completedProspects">
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="@RemoveInteraction"></ProspectContainer>
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="RemoveInteraction"></ProspectContainer>
</Repeater>
</div>
}

View File

@@ -16,7 +16,7 @@ namespace FoodsharingSiegen.Server.Pages
/// <summary>
/// Gets or sets the value of the message service (ab)
/// </summary>
[Inject] IMessageService MessageService { get; set; }
[Inject] private IMessageService MessageService { get; set; } = null!;
/// <summary>
/// Gets or sets the value of the prospect service (ab)
@@ -35,22 +35,22 @@ namespace FoodsharingSiegen.Server.Pages
/// <summary>
/// Gets or sets the value of the interaction modal (ab)
/// </summary>
public AddInteractionModal InteractionModal { get; set; }
private AddInteractionModal? InteractionModal { get; set; }
/// <summary>
/// Gets or sets the value of the prospect list (ab)
/// </summary>
public List<Prospect>? ProspectList { get; set; }
private List<Prospect>? ProspectList { get; set; }
/// <summary>
/// Gets or sets the value of the prospect modal (ab)
/// </summary>
public AddProspectModal ProspectModal { get; set; } = null!;
private AddProspectModal ProspectModal { get; set; } = null!;
/// <summary>
/// Gets or sets the value of the users (ab)
/// </summary>
public List<User>? Users { get; set; }
private List<User>? Users { get; set; }
#endregion
@@ -63,9 +63,7 @@ namespace FoodsharingSiegen.Server.Pages
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await LoadProspects();
}
await base.OnAfterRenderAsync(firstRender);
}
@@ -158,7 +156,7 @@ namespace FoodsharingSiegen.Server.Pages
o.CancelButtonText = "Abbrechen";
o.ShowMessageIcon = false;
});
if (confirm)
{
await ProspectService.RemoveInteraction(arg);

View File

@@ -27,7 +27,7 @@
<h2>Benutzerverwaltung <span style="font-size: .5em; line-height: 0;">Admin</span></h2>
<div class="my-2">
<Button Color="Color.Primary" Disabled="@(SelectedUser == null)" Clicked="() => PasswordModal.Show(SelectedUser!)"><i class="fa-solid fa-key"></i>&nbsp;setzen</Button>
<Button Color="Color.Primary" Disabled="@(SelectedUser == null)" Clicked="async () => await PasswordModal?.Show(SelectedUser!)!"><i class="fa-solid fa-key"></i>&nbsp;setzen</Button>
</div>
<DataGrid TItem="User"
@@ -39,7 +39,7 @@
RowInserted="RowInserted"
RowUpdated="RowUpdated"
@bind-SelectedRow="SelectedUser"
RowDoubleClicked="arg => UserDataGrid.Edit(arg.Item)"
RowDoubleClicked="arg => UserDataGrid?.Edit(arg.Item)!"
Editable
Responsive="true">
<DataGridColumns>

View File

@@ -28,7 +28,7 @@ namespace FoodsharingSiegen.Server.Pages
/// <summary>
/// Gets or sets the value of the password modal (ab)
/// </summary>
private SetPasswordModal PasswordModal { get; set; }
private SetPasswordModal? PasswordModal { get; set; }
/// <summary>
/// Gets or sets the value of the selected company texts (ab)
@@ -43,7 +43,7 @@ namespace FoodsharingSiegen.Server.Pages
/// <summary>
/// Gets or sets the value of the user data grid (ab)
/// </summary>
private DataGrid<User> UserDataGrid { get; set; }
private DataGrid<User>? UserDataGrid { get; set; }
/// <summary>
/// Gets the value of the user groups (ab)
@@ -96,9 +96,9 @@ namespace FoodsharingSiegen.Server.Pages
/// <param name="user">The user</param>
private async Task OnPasswordSet(User user)
{
var setPasswordR = await UserService?.SetPassword(user)!;
var setPasswordR = await UserService.SetPassword(user);
if(setPasswordR.Success)
await Notification?.Success("Passwort gespeichert")!;
await Notification.Success("Passwort gespeichert");
}
#endregion
@@ -113,7 +113,7 @@ namespace FoodsharingSiegen.Server.Pages
{
var addUserR = await UserService.AddUserAsync(arg.Item);
if (!addUserR.Success)
await Notification?.Error($"Fehler beim Anlegen: {addUserR.ErrorMessage}")!;
await Notification.Error($"Fehler beim Anlegen: {addUserR.ErrorMessage}")!;
else
await LoadUsers();
}
@@ -130,7 +130,10 @@ namespace FoodsharingSiegen.Server.Pages
{
if (arg.Item?.Id == null || arg.Item.Id.Equals(Guid.Empty) || arg.Values?.Any() != true) return;
var result = await UserService.Update(arg.Item);
var updateR = await UserService.Update(arg.Item);
if(!updateR.Success)
await Notification.Error($"Fehler beim Speichern: {updateR.ErrorMessage}")!;
}
#endregion