public ActionResult editPM(String _id) { int id = int.Parse(_id); PlatetbniMoznostDao dao = new PlatetbniMoznostDao(); PlatetbniMoznost model = dao.GetById(id); return(View(model)); }
public ActionResult PlatebMoznosti() { PlatetbniMoznostDao platetbniMoznostDao = new PlatetbniMoznostDao(); IList <PlatetbniMoznost> platba = platetbniMoznostDao.GetlAll(); if (Request.IsAjaxRequest()) { return(PartialView("PlatetbniMoznostAjax", platba)); } return(View(platba)); }
public ActionResult addPM(PlatetbniMoznost model) { if (ModelState.IsValidField("Cena") && ModelState.IsValidField("Popis") && ModelState.IsValidField("Nazev")) { PlatetbniMoznostDao platetbniMoznostDao = new PlatetbniMoznostDao(); platetbniMoznostDao.Create(model); return(RedirectToAction("PlatebMoznosti")); } else { return(View("novaPM", model)); } }
public ActionResult aktivacePM(String _id) { int id = int.Parse(_id); PlatetbniMoznostDao dao = new PlatetbniMoznostDao(); PlatetbniMoznost model = dao.GetById(id); if (model.Aktivovano) { model.Aktivovano = false; } else { model.Aktivovano = true; } dao.Update(model); return(RedirectToAction("PlatebMoznosti")); }
public ActionResult Kosik() { PlatetbniMoznostDao platetbniMoznostDao = new PlatetbniMoznostDao(); IList <PlatetbniMoznost> platba = platetbniMoznostDao.getAktiv(false); DopravaMoznostDao dopravaMoznostDao = new DopravaMoznostDao(); IList <DopravaMoznost> doprava = dopravaMoznostDao.getAktiv(false); Ucet ucet = new Ucet(); foreach (DopravaMoznost item in doprava) { item.Nazev = item.Nazev + " " + item.Cena + " Kč"; } foreach (PlatetbniMoznost item in platba) { item.Nazev = item.Nazev + " " + item.Cena + " Kč"; } ViewBag.platby = platba; ViewBag.doprava = doprava; if (User.Identity.Name != "") { ucet = new UcetDao().GetByLogin(User.Identity.Name); IList <PolozkaKosik> polozky = new PolozkaKosikDao().GetByUzivatel(ucet.Id); Kosik kosik = new Kosik(polozky); @ViewBag.Jmeno = ucet.Jmeno; @ViewBag.Prijmeni = ucet.Prijmeni; @ViewBag.Telefon = ucet.Telefon; @ViewBag.Email = ucet.Email; @ViewBag.uzivatel = ucet.Id; @ViewBag.Mesto = ucet.Adresa.Mesto; @ViewBag.PSC = ucet.Adresa.PSC; @ViewBag.UliceCP = ucet.Adresa.UliceCP; @ViewBag.Zeme = ucet.Adresa.Zeme; kosik.vymazani(); return(View(kosik)); } else { if (Request.Cookies["kosik"] != null) { string objCartListString = Request.Cookies["kosik"].Value.ToString(); string[] objCartListStringSplit = objCartListString.Split('|'); IList <PolozkaKosik> polozky = new List <PolozkaKosik>(); foreach (string s in objCartListStringSplit) { PolozkaKosik polozka = new PolozkaKosik(); string[] ss = s.Split(','); polozka.Hra = new GameDao().GetById(Convert.ToInt32(ss[0])); polozka.Mnozstvi = Convert.ToInt32(ss[1]); polozky.Add(polozka); } Kosik kosik = new Kosik(polozky); @ViewBag.Jmeno = ucet.Jmeno; @ViewBag.Prijmeni = ucet.Prijmeni; @ViewBag.Telefon = ucet.Telefon; @ViewBag.Email = ucet.Email; @ViewBag.uzivatel = ucet.Id; @ViewBag.Mesto = ucet.Adresa.Mesto; @ViewBag.PSC = ucet.Adresa.PSC; @ViewBag.UliceCP = ucet.Adresa.UliceCP; @ViewBag.Zeme = ucet.Adresa.Zeme; return(View(kosik)); } else { Kosik kosik = new Kosik(); @ViewBag.Jmeno = ucet.Jmeno; @ViewBag.Prijmeni = ucet.Prijmeni; @ViewBag.Telefon = ucet.Telefon; @ViewBag.Email = ucet.Email; @ViewBag.uzivatel = ucet.Id; @ViewBag.Mesto = ucet.Adresa.Mesto; @ViewBag.PSC = ucet.Adresa.PSC; @ViewBag.UliceCP = ucet.Adresa.UliceCP; @ViewBag.Zeme = ucet.Adresa.Zeme; kosik.vymazani(); return(View(kosik)); } } }