public ActionResult KreditKartenZahlung(KreditKartenZahlungVM vm) { var result = DAL.Logic.Helper.IsCCValid(vm.KartenNr); if (result == true) { //Hier muss man nun anhand der Diamantenpackid den Eintrag in die DB machen //1. Hole alle Diamantenpackinfos DiamantenPack diamantenpack = ShopManager.GetDiamantenPackById(vm.IdDiamantenPack); //2. Addiere die Anzahl an Diamanten vom Diamantenpack zum User ShopManager.AddDiamondsToUser(User.Identity.Name, (int)diamantenpack.Diamanten); //3. Trage den Kauf des Diamantenpacks in VirtualPurchases ein ShopManager.InsertVirtualDiamondPurchase(User.Identity.Name, vm.IdDiamantenPack); TempData["ConfirmMessage"] = "Sie haben" + " " + diamantenpack.Diamanten + " " + "Diamanten gekauft"; return(RedirectToAction("BestellungDanke", "Shop")); } else { TempData["ErrorMessage"] = "Ungültige Kartennummer!"; return(View(vm)); } }
public ActionResult DiamantenpackErwerben(int idDiamantenPack) { //hole Diamenteninfos über id DiamantenPack diamanten = ShopManager.GetDiamantenPackById(idDiamantenPack); KreditKartenZahlungVM kvm = new KreditKartenZahlungVM(); kvm.Preis = diamanten.PackPrice; kvm.AnzahlDiamanten = (int)diamanten.Diamanten; kvm.IdDiamantenPack = diamanten.ID; //return RedirectToAction("KreditKartenZahlung", idDiamantenPack); return(View("KreditKartenZahlung", kvm)); }