mirror of
https://github.com/yummy4friends/y4f.git
synced 2024-12-27 22:48:19 +01:00
Fix treuepunkte vergabe
This commit is contained in:
parent
314c8667e6
commit
9e8942ef43
@ -221,8 +221,8 @@ public partial class WebApiContext : DbContext
|
||||
|
||||
entity.ToTable("bestellungsposition_has_menuitem");
|
||||
|
||||
entity.Property(e => e.Bestellungsposition_IDBestellung).HasColumnType("int(11)").HasColumnName("bestellungsposition_IDBestellung");
|
||||
entity.Property(e => e.MenuItem_IDMenuItem).HasColumnType("int(11)").HasColumnName("menuItem_IDMenuItem");
|
||||
entity.Property(e => e.Bestellungsposition_IDBestellung).HasColumnType("int(11)").HasColumnName("Bestellungsposition_IDBestellung");
|
||||
entity.Property(e => e.MenuItem_IDMenuItem).HasColumnType("int(11)").HasColumnName("MenuItem_IDMenuItem");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<MenuitemHasAllergie>(entity =>
|
||||
|
@ -89,14 +89,15 @@
|
||||
{
|
||||
localStorage.SetItem("RabattEinloesen", false);
|
||||
localStorage.SetItem("Summe", summe);
|
||||
// if summe > 8€ add treuepunkte
|
||||
if (summe >= 8)
|
||||
{
|
||||
if (kunde.Treuepunkte < 10)
|
||||
{
|
||||
kunde.Treuepunkte++;
|
||||
// add treuepunkte to API
|
||||
Http.PutAsJsonAsync("https://localhost:7076/api/kunden/" + kunde.Idkunde, kunde);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add bestellung to API
|
||||
// add all bestellungspositionen to API
|
||||
@ -138,12 +139,20 @@
|
||||
|
||||
Http.PostAsJsonAsync("https://localhost:7076/api/bestellungspositionen", bestellungsposition);
|
||||
|
||||
//Add menuitems to bestellungspositionHasMenuItem
|
||||
BestellungspositionHasMenuitem bestellungspositionHasMenuItem = new BestellungspositionHasMenuitem();
|
||||
bestellungspositionHasMenuItem.Bestellungsposition_IDBestellung = bestellungsposition.Idbestellung;
|
||||
bestellungspositionHasMenuItem.MenuItem_IDMenuItem = item.Key;
|
||||
////Add menuitems to bestellungspositionHasMenuItem
|
||||
//BestellungspositionHasMenuitem bestellungspositionHasMenuItem = new BestellungspositionHasMenuitem();
|
||||
//bestellungspositionHasMenuItem.Bestellungsposition_IDBestellung = bestellungsposition.Idbestellung;
|
||||
//bestellungspositionHasMenuItem.MenuItem_IDMenuItem = item.Key;
|
||||
|
||||
Http.PostAsJsonAsync("https://localhost:7076/api/bestellungspositionhasmenuitems", bestellungspositionHasMenuItem);
|
||||
//Http.PostAsJsonAsync("https://localhost:7076/api/bestellungspositionhasmenuitems", bestellungspositionHasMenuItem);
|
||||
|
||||
var newBestellungsposition = new BestellungspositionHasMenuitem()
|
||||
{
|
||||
Bestellungsposition_IDBestellung = bestellungsposition.Idbestellung,
|
||||
MenuItem_IDMenuItem = item.Key
|
||||
};
|
||||
|
||||
Http.PostAsJsonAsync("https://localhost:7076/api/bestellungspositionhasmenuitems", newBestellungsposition);
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<p id="text" readonly>Abholzeit</p>
|
||||
@* <p id="text" readonly>Abholzeit</p>
|
||||
<br />
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="30 Min" class="btn">
|
||||
@ -75,7 +75,7 @@
|
||||
</form>
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="1 Std" class="btn">
|
||||
</form>
|
||||
</form>*@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -118,6 +118,22 @@
|
||||
month = DateTime.Now.Month;
|
||||
year = DateTime.Now.Year;
|
||||
|
||||
//sort bestellungspositions by datum
|
||||
bestellungspositions = bestellungspositions.OrderByDescending(x => x.Datum).ToList();
|
||||
//sort kunden by the order of bestellungspositions
|
||||
List<Kunde> kundenSorted = new List<Kunde>();
|
||||
foreach (var bestellungsposition in bestellungspositions)
|
||||
{
|
||||
foreach (var kunde in kunden)
|
||||
{
|
||||
if (bestellungsposition.KundeIdkunde == kunde.Idkunde && !kundenSorted.Contains(kunde))
|
||||
{
|
||||
kundenSorted.Add(kunde);
|
||||
}
|
||||
}
|
||||
}
|
||||
kunden = kundenSorted;
|
||||
|
||||
}
|
||||
|
||||
public class Bestellungsposition
|
||||
|
@ -99,7 +99,7 @@
|
||||
|
||||
<div class="d-flex flex-column" style="align-items: center; margin-left: 100px;">
|
||||
@*<button class="btn_back w-75">Zurück</button>*@
|
||||
@*<button class="btn btn-danger w-75" style="border-radius: 50px; padding-top:12px; padding-bottom:12px; color:black;">Bestellung auflösen</button>*@
|
||||
@*<button class="btn btn-danger w-75" style="border-radius: 50px; padding-top:12px; padding-bottom:12px; color:black;" @onclick="Aufloesen">Bestellung auflösen</button>*@
|
||||
@*<button class="btn_forward w-75">Bestellung abschließen</button>*@
|
||||
</div>
|
||||
|
||||
@ -150,6 +150,25 @@
|
||||
localStorage.Clear();
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
|
||||
//public void Aufloesen()
|
||||
//{
|
||||
// foreach (var bestellungsposition in bestellungspositions)
|
||||
// {
|
||||
// foreach (var bestellungspositionHasMenuitem in bestellungspositionHasMenuitems)
|
||||
// {
|
||||
// if (bestellungsposition.Idbestellung == bestellungspositionHasMenuitem.Bestellungsposition_IDBestellung)
|
||||
// {
|
||||
// Http.DeleteAsync("https://localhost:7076/api/BestellungspositionHasMenuitems/" + bestellungspositionHasMenuitem.Bestellungsposition_IDBestellung + "/" + bestellungspositionHasMenuitem.MenuItem_IDMenuItem);
|
||||
// }
|
||||
// }
|
||||
// if (bestellungsposition.KundeIdkunde == kunde.Idkunde)
|
||||
// {
|
||||
// Http.DeleteAsync("https://localhost:7076/api/Bestellungspositionen/" + bestellungsposition.Idbestellung);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// get data from api
|
||||
|
Loading…
Reference in New Issue
Block a user