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")); } }
public Bestelling ConstructBestelling(Bestelling bestelling) { Klant klant = klantRepository.GetById(bestelling.KlantId); //Product lijst List <Product> cart = new List <Product>(); foreach (Product p in SessionHelper.GetObjectFromJson <List <Product> >(HttpContext.Session, "cart")) { cart.Add(p); } bestelling.Products = cart; //Prijs gedeelte decimal subtotaal = 0; foreach (Product p in bestelling.Products) { subtotaal = subtotaal + Convert.ToDecimal(p.Prijs); } bestelling.Totaalprijs = subtotaal.ToString(); //Klant Data bestelling.Huisnummer = klant.Huisnummer; bestelling.Postcode = klant.Postcode; return(bestelling); }
public int GetKlantPunten() { long id = GetUserId(); Klant k = klantRepository.GetById(id); return(k.Punten); }
public IActionResult Index(long id) { string rawValue = HttpContext.User.Identities.First().Claims.First().Value; if (string.IsNullOrEmpty(rawValue)) { return(View()); } if (long.TryParse(rawValue, out id)) { KlantDetailViewModel vm = new KlantDetailViewModel(); Klant klant = klantrepository.GetById(id); vm = klantConverter.ModelToViewModel(klant); return(View(vm)); } return(View()); }
public IActionResult Index() { BaseAccountDetailViewmodel vm = klantConverter.ModelToViewModel(klantRepository.GetById(GetUserId())); return(View(vm)); }