// GET: Term public ActionResult Index() { TermDao tDao = new TermDao(); IList <Term> terms = tDao.GetNewTerms(); ViewBag.Mark = "Term"; return(View(terms)); }
// GET: Admin/Term public ActionResult Index(int?currentTerms) { int curT = currentTerms ?? 1; TermDao tDao = new TermDao(); IList <Term> terms = null; UserDao uDao = new UserDao(); FitnessUser u = uDao.GetByLogin(User.Identity.Name); if (u.Role.Name == "Trenér" && curT == 0) { terms = tDao.GetOldTermsByTrainer(u); } else if (u.Role.Name == "Trenér" && curT == 1) { terms = tDao.GetNewTermsByTrainer(u); } else if (u.Role.Name == "Ředitel" && curT == 0) { terms = tDao.GetOldTerms(); } else // pro zakaznazniky, udrzbare i pro if (u.Role.Name == "Ředitel" && curT == 1) plati ze se zobrazi vsechny aktualni terminy { terms = tDao.GetNewTerms(); } ViewBag.CurrentTerm = curT; ViewBag.Mark = "Term"; if (Request.IsAjaxRequest()) { if (u.Role.Name == "Zákazník" || u.Role.Name == "Údržbář") { return(PartialView("CustomerIndex", terms)); } return(PartialView(terms)); } else { if (u.Role.Name == "Zákazník" || u.Role.Name == "Údržbář") { return(View("CustomerIndex", terms)); } return(View(terms)); } }