public ActionResult Verwerken() { try { double totaalPrijs = 0; int poid = -1; if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Index", "Account")); } if (Session["SESwkm"] == null) { return(RedirectToAction("Index", "Home")); } Winkelmand qwkm = (Winkelmand)Session["SESwkm"]; mvvm.ListMand = qwkm.GetAllwinkelmand(); mvvm.gebruiker = gebruikerdbcontroller.GetGebruiker(User.Identity.Name); for (int q = 0; q < mvvm.ListMand.Count; q++) { if (mvvm.gebruiker.Goldmembership == true) { totaalPrijs += ((mvvm.ListMand[q].Prijs * mvvm.ListMand[q].Aantal) * 0.96); } else { totaalPrijs += (mvvm.ListMand[q].Prijs * mvvm.ListMand[q].Aantal); } } orderdbcontroller.InsertOrder(mvvm.gebruiker.ID, totaalPrijs); poid = orderdbcontroller.GetOrderID(mvvm.gebruiker.ID); for (int a = 0; a < mvvm.ListMand.Count; a++) { if (mvvm.gebruiker.Goldmembership == true) { orderdbcontroller.InsertOrderRegel(mvvm.ListMand[a].ID, poid, mvvm.ListMand[a].Aantal, ((mvvm.ListMand[a].Prijs * mvvm.ListMand[a].Aantal) * 0.96)); } else { orderdbcontroller.InsertOrderRegel(mvvm.ListMand[a].ID, poid, mvvm.ListMand[a].Aantal, (mvvm.ListMand[a].Prijs * mvvm.ListMand[a].Aantal)); } } qwkm.DeleteAllwinkelmand(); return(RedirectToAction("Voltooid", "Winkelmand", new { oid = poid })); } catch (Exception e) { return(RedirectToAction("Index", "Winkelmand")); } }
public ActionResult Legen() { try { if (Session["SESwkm"] == null) { RedirectToAction("Index", "Winkelmand"); } Winkelmand qwkm = (Winkelmand)Session["SESwkm"]; qwkm.DeleteAllwinkelmand(); return(RedirectToAction("Index", "Winkelmand")); } catch (Exception e) { return(RedirectToAction("Index", "Winkelmand")); } }