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

View File

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

View File

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

View File

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

View File

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