Exemplo n.º 1
0
        public IActionResult Bestel()
        {
            List <Product> cart = CartProducten();

            if (cart != null)
            {
                long id = GetUserId();
                klantRepository.GetKlantID(id);
                Klant k = klantRepository.GetById(id);

                if (bestellingRepository.Bestellen(cart, k.Id) == true)
                {
                    int punten = Convert.ToInt32(BerekenPoints(cart));
                    klantRepository.UpdateKlantPunten(punten, Convert.ToInt32(GetUserId()));
                    //update klant punten
                    DeleteCartProducts(cart);

                    return(View("BestellingBevestiging"));
                }
                else
                {
                    return(RedirectToAction("Index", "WinkelWagen"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "WinkelWagen"));
            }
        }