mirror of
https://github.com/yummy4friends/y4f.git
synced 2024-12-27 22:48:19 +01:00
Add kunden login index
This commit is contained in:
parent
7b8db08d99
commit
a9418aea33
@ -1,6 +1,8 @@
|
||||
@page "/"
|
||||
@layout Startseite
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
|
||||
<PageTitle>Yummy4Friends</PageTitle>
|
||||
|
||||
@ -14,10 +16,43 @@
|
||||
|
||||
<button type="submit" id="button1" class="btn">QR-Code einscannen</button>
|
||||
|
||||
<input type="text" class="form-control" id="qrcode" placeholder="Zugangscode eintragen" name="qrcode">
|
||||
<input type="text" class="form-control" id="qrcode" placeholder="Zugangscode eintragen" name="qrcode" @bind-value="@qrcodeValue">
|
||||
|
||||
<button type="submit" id="button1" class="btn">Bestätigen</button>
|
||||
<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; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user