mirror of
https://github.com/yummy4friends/y4f.git
synced 2024-12-28 14:58:20 +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.ToTable("bestellungsposition_has_menuitem");
|
||||||
|
|
||||||
entity.Property(e => e.Bestellungsposition_IDBestellung).HasColumnType("int(11)").HasColumnName("bestellungsposition_IDBestellung");
|
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.MenuItem_IDMenuItem).HasColumnType("int(11)").HasColumnName("MenuItem_IDMenuItem");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<MenuitemHasAllergie>(entity =>
|
modelBuilder.Entity<MenuitemHasAllergie>(entity =>
|
||||||
|
@ -89,14 +89,15 @@
|
|||||||
{
|
{
|
||||||
localStorage.SetItem("RabattEinloesen", false);
|
localStorage.SetItem("RabattEinloesen", false);
|
||||||
localStorage.SetItem("Summe", summe);
|
localStorage.SetItem("Summe", summe);
|
||||||
// if summe > 8€ add treuepunkte
|
|
||||||
if (summe >= 8)
|
if (summe >= 8)
|
||||||
|
{
|
||||||
|
if (kunde.Treuepunkte < 10)
|
||||||
{
|
{
|
||||||
kunde.Treuepunkte++;
|
kunde.Treuepunkte++;
|
||||||
// add treuepunkte to API
|
|
||||||
Http.PutAsJsonAsync("https://localhost:7076/api/kunden/" + kunde.Idkunde, kunde);
|
Http.PutAsJsonAsync("https://localhost:7076/api/kunden/" + kunde.Idkunde, kunde);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add bestellung to API
|
// add bestellung to API
|
||||||
// add all bestellungspositionen to API
|
// add all bestellungspositionen to API
|
||||||
@ -138,12 +139,20 @@
|
|||||||
|
|
||||||
Http.PostAsJsonAsync("https://localhost:7076/api/bestellungspositionen", bestellungsposition);
|
Http.PostAsJsonAsync("https://localhost:7076/api/bestellungspositionen", bestellungsposition);
|
||||||
|
|
||||||
//Add menuitems to bestellungspositionHasMenuItem
|
////Add menuitems to bestellungspositionHasMenuItem
|
||||||
BestellungspositionHasMenuitem bestellungspositionHasMenuItem = new BestellungspositionHasMenuitem();
|
//BestellungspositionHasMenuitem bestellungspositionHasMenuItem = new BestellungspositionHasMenuitem();
|
||||||
bestellungspositionHasMenuItem.Bestellungsposition_IDBestellung = bestellungsposition.Idbestellung;
|
//bestellungspositionHasMenuItem.Bestellungsposition_IDBestellung = bestellungsposition.Idbestellung;
|
||||||
bestellungspositionHasMenuItem.MenuItem_IDMenuItem = item.Key;
|
//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>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-3">
|
<div class="col-lg-3">
|
||||||
<p id="text" readonly>Abholzeit</p>
|
@* <p id="text" readonly>Abholzeit</p>
|
||||||
<br />
|
<br />
|
||||||
<form id="button" action="Bestelluebersicht">
|
<form id="button" action="Bestelluebersicht">
|
||||||
<input type="submit" value="30 Min" class="btn">
|
<input type="submit" value="30 Min" class="btn">
|
||||||
@ -75,7 +75,7 @@
|
|||||||
</form>
|
</form>
|
||||||
<form id="button" action="Bestelluebersicht">
|
<form id="button" action="Bestelluebersicht">
|
||||||
<input type="submit" value="1 Std" class="btn">
|
<input type="submit" value="1 Std" class="btn">
|
||||||
</form>
|
</form>*@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -118,6 +118,22 @@
|
|||||||
month = DateTime.Now.Month;
|
month = DateTime.Now.Month;
|
||||||
year = DateTime.Now.Year;
|
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
|
public class Bestellungsposition
|
||||||
|
@ -99,7 +99,7 @@
|
|||||||
|
|
||||||
<div class="d-flex flex-column" style="align-items: center; margin-left: 100px;">
|
<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_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>*@
|
@*<button class="btn_forward w-75">Bestellung abschließen</button>*@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -150,6 +150,25 @@
|
|||||||
localStorage.Clear();
|
localStorage.Clear();
|
||||||
_navigationManager.NavigateTo("/");
|
_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()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
// get data from api
|
// get data from api
|
||||||
|
Loading…
Reference in New Issue
Block a user