Fix kunde.Idkunde access

This commit is contained in:
MET18937
2023-06-25 20:19:03 +02:00
parent d32a517013
commit 8abba97ab8
6 changed files with 88 additions and 86 deletions

View File

@ -83,10 +83,12 @@
Http.PutAsJsonAsync("https://localhost:7076/api/kunden/" + kunde.Idkunde, kunde);
summe = Math.Round(summe - (summe * rabatt.Prozent / 100), 2);
localStorage.SetItem("Summe", summe);
localStorage.SetItem("RabattEinloesen", true);
}
else
{
localStorage.SetItem("RabattEinloesen", false);
localStorage.SetItem("Summe", summe);
}
// add bestellung to API
@ -167,7 +169,7 @@
bestellungspositionHasMenuitems = await Http.GetFromJsonAsync<List<BestellungspositionHasMenuitem>>("https://localhost:7076/api/BestellungspositionHasMenuitems");
// test use the first kunde
kunde = kunden[0];
kunde = kunden[1];
// get the most recent rabatt, that are still valid (GueltigkeitBis)
// if there is no rabatt, set the rabatt to null

View File

@ -85,7 +85,7 @@
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
// test use the first kunde
kunde = kunden[0];
kunde = kunden[1];
// get the most recent rabatt, that are still valid (GueltigkeitBis)
// if there is no rabatt, set the rabatt to null

View File

@ -28,8 +28,8 @@
@*get the last highes datum from Datum*@
if (firstTime)
{
if (bestellungsposition.Datum == bestellungspositions.Max(x => x.Datum))
{
@*if (bestellungsposition.Datum == bestellungspositions.Max(x => x.Datum))*@
@*{*@
@*get hour and minute from datetime of last bestellungsposition*@
hour = bestellungsposition.Datum.Hour;
minute = bestellungsposition.Datum.Minute;
@ -50,7 +50,7 @@
</td>
</tr>
}
}
@*}*@
firstTime = false;
}
}

View File

@ -156,8 +156,8 @@
{
if (bestellungsposition.KundeIdkunde == kunde.Idkunde)
{
if (bestellungsposition.Datum == bestellungspositions.Max(x => x.Datum))
{
//if (bestellungsposition.Datum == bestellungspositions.Max(x => x.Datum))
//{
// get hour and minute from datetime of last bestellungsposition
hour = bestellungsposition.Datum.Hour;
@ -186,7 +186,7 @@
menuitemIds.Add(bestellungspositionHasMenuitem.MenuItem_IDMenuItem, bestellungsposition.Menge);
}
}
}
//}
}
}
// get summe

View File

@ -64,7 +64,6 @@
</tr>
}
}
}
}
</tbody>
@ -170,14 +169,16 @@
bestellungspositionHasMenuitems = await Http.GetFromJsonAsync<List<BestellungspositionHasMenuitem>>("https://localhost:7076/api/BestellungspositionHasMenuitems");
// use kudnde with id 1
kunde = kunden[0];
// use kudnde with id 2
kunde = kunden[1];
// get all menuitemIds from bestellungspositions with the last date
foreach (var bestellungsposition in bestellungspositions)
foreach (Bestellungsposition bestellungsposition in bestellungspositions)
{
if (bestellungsposition.KundeIdkunde == kunde.Idkunde)
{
if (bestellungsposition.Datum == bestellungspositions.Max(x => x.Datum))
{
// get hour and minute from datetime of last bestellungsposition
@ -209,7 +210,6 @@
}
}
}
}
// get summe
foreach (var menuitem in menuitems)
{

View File

@ -62,7 +62,7 @@
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
kunde = kunden[0];
kunde = kunden[1];
// get the most recent rabatt, that are still valid (GueltigkeitBis)
// if there is no rabatt, set the rabatt to null