Add kunden login index

This commit is contained in:
MET18937 2023-06-24 17:11:52 +02:00
parent 7b8db08d99
commit a9418aea33

View File

@ -1,23 +1,58 @@
 @page "/"
@layout Startseite
@page "/"
@layout Startseite
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
<PageTitle>Yummy4Friends</PageTitle>
<body style='--blazor-load-percentage: 100%; --blazor-load-percentage-text: "100%"; background-color:#C7FFD5;'>
<div class="container col-lg-6 col-md-9 col-sm-12 d-flex flex-column " id="content" style=" padding-left:10%; padding-right:10%;">
<center><h1>Herzlich Willkommen!</h1></center>
<img src="assets/Logo_new.png" class="img" title="logo image">
<div class="container col-lg-6 col-md-9 col-sm-12 d-flex flex-column " id="content" style=" padding-left:10%; padding-right:10%;">
<center><h1>Herzlich Willkommen!</h1></center>
<button type="submit" id="button1" class="btn">QR-Code einscannen</button>
<img src="assets/Logo_new.png" class="img" title="logo image">
<input type="text" class="form-control" id="qrcode" placeholder="Zugangscode eintragen" name="qrcode">
<button type="submit" id="button1" class="btn">QR-Code einscannen</button>
<button type="submit" id="button1" class="btn">Bestätigen</button>
</div>
<input type="text" class="form-control" id="qrcode" placeholder="Zugangscode eintragen" name="qrcode" @bind-value="@qrcodeValue">
<button type="submit" id="button1" class="btn" @onclick="@(() => CheckCode())">Bestätigen</button>
</div>
</body>
@code {
private string qrcodeValue;
private List<Kunde> kunden = new List<Kunde>();
public void CheckCode()
{
foreach (var kunde in kunden)
{
if (kunde.Code == qrcodeValue)
{
localStorage.SetItem("kunde", kunde);
break;
}
}
}
protected override async Task OnInitializedAsync()
{
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
}
public class Kunde
{
public int Idkunde { get; set; }
public string Code { get; set; }
public int Treuepunkte { get; set; }
}
}