public void Zaplac(double suma, SposobPlatnosci wybranaPlatnosc) { Platnosc platnosc = new Platnosc(); platnosc.zarejestrujPlatnosc(); switch (wybranaPlatnosc) { case SposobPlatnosci.Karta: try { platnosc = new Karta(100); ((Karta)platnosc).Zaplac(suma); platnosc.generujPotwierdzenieZamowienia(); } catch (NotEnoughFundsOnCreditCardException ex) { //throw new Exception("Platnosc nieudana: " + ex.Message); Console.WriteLine("Platnosc nieudana: " + ex.Message); } break; case SposobPlatnosci.Przelew: platnosc = new Przelew(); platnosc.generujPotwierdzenieZamowienia(); break; } }
public ActionResult Dodaj(FormCollection collection) { var Model = new SposobPlatnosci(); try { UpdateModel(Model); if (Model.IsValid) { SposobyPlatnosciRepository.Dodaj(Model); SposobyPlatnosciRepository.Save(); TempData["Message"] = String.Format("Dodano sposób płatności \"{0}\"", Model.KodSposobuPlatnosci); return(RedirectToAction("Kartoteka")); } else { foreach (var rule in Model.GetRuleViolations()) { ModelState.AddModelError(rule.PropertyName, rule.ErrorMessage); } return(View(Model)); } } catch (Exception ex) { ViewBag.ErrorMessage = "Wystąpił błąd podczas dodawania sposobu płatności"; Logger.ErrorFormat("Wystąpił błąd podczas dodawania sposobu płatności\n{0}", ex); return(View(Model)); } }
public void Dodaj(SposobPlatnosci inwestycja) { db.SposobPlatnoscis.InsertOnSubmit(inwestycja); }
public ActionResult Dodaj() { var Model = new SposobPlatnosci(); return(View(Model)); }
public void Usun(SposobPlatnosci inwestycja) { db.SposobPlatnoscis.DeleteOnSubmit(inwestycja); }