// GET: Home public ActionResult Index() { if (!Uzivatel.UserExists(User.Identity.Name)) { TempData[MessagesHelper.Info] = Resources.HomeTexts.NotAuthorized; return(RedirectToAction("About", "Home")); } var me = new Uzivatel(User.Identity.Name); // 1. naštení 28ms var me2 = new Uzivatel(User.Identity.Name); // 2. 6ms - jak? jsem frajer..... Jarda /*var lops = new LopDao().GetAll(uziv); * var ukolved = new UkolVedeniDao().GetAll(uziv); * var ukoloddel = new UkolOddeleniDao().GetAll(uziv); * var ukolvzork = new UkolVzorkovaniDao().GetAll(uziv); * * return View(new HomeCollection(lops, ukoloddel, ukolved, ukolvzork)); */ var lopDao = new LopDao(); ViewBag.lopMeAsZadavatel = lopDao.GetAll(); ViewBag.lopMeAsResitel = lopDao.GetAll(); return(View()); }
public ActionResult All() { if (!Uzivatel.UserExists(User.Identity.Name)) { TempData[MessagesHelper.Info] = Resources.HomeTexts.NotAuthorized; return(RedirectToAction("About", "Home")); } ViewBag.showAll = true; return(View("Index", new LopDao().GetAll())); }
public override bool IsUserInRole(string username, string roleName) { if (roleName == "authorized") { return(Uzivatel.UserExists(username)); } var user = new Uzivatel(username); return(user.Role.Identificator == roleName); }
// GET: UkolVzorkovani public ActionResult Index() { if (!Uzivatel.UserExists(User.Identity.Name)) { TempData[MessagesHelper.Info] = Resources.HomeTexts.NotAuthorized; return(RedirectToAction("About", "Home")); } var dao = new UkolVzorkovaniDao(); var list = dao.GetAll(new UzivatelDao().GetByWindowsId(User.Identity.Name)); return(View(list)); }
// GET: Notifikace public ActionResult Index() { if (!Uzivatel.UserExists(User.Identity.Name)) { TempData[MessagesHelper.Info] = Resources.HomeTexts.NotAuthorized; return(RedirectToAction("About", "Home")); } var dao = new NotifikaceDao(); var nove = dao.GetByUser(new Uzivatel(User.Identity.Name), false); var seen = dao.GetByUser(new Uzivatel(User.Identity.Name)); ViewBag.nove = nove; ViewBag.seen = seen; return(View()); }
// GET: Lop public ActionResult Index(bool?smazane) { if (!Uzivatel.UserExists(User.Identity.Name)) { TempData[MessagesHelper.Info] = Resources.HomeTexts.NotAuthorized; return(RedirectToAction("About", "Home")); } ViewBag.showAll = false; var lopDao = new LopDao(); IList <Lop> listLop; if (smazane == true) { ViewBag.ZeSmazanych = true; listLop = lopDao.GetOnlyDeleted(new UzivatelDao().GetByWindowsId(User.Identity.Name)); } else { listLop = lopDao.GetAll(new UzivatelDao().GetByWindowsId(User.Identity.Name)); } return(View(listLop)); }
// GET: UkolVedeni public ActionResult Index(bool?smazane) { if (!Uzivatel.UserExists(User.Identity.Name)) { TempData[MessagesHelper.Info] = Resources.HomeTexts.NotAuthorized; return(RedirectToAction("About", "Home")); } var dao = new UkolVedeniDao(); IList <UkolVedeni> list; if (smazane == true) { ViewBag.ZeSmazanych = true; //TODO otestovat! list = dao.GetOnlyDeleted(new UzivatelDao().GetByWindowsId(User.Identity.Name)); } else { list = dao.GetAll(new UzivatelDao().GetByWindowsId(User.Identity.Name)); } return(View(list)); }
public override string[] GetRolesForUser(string username) { var user = new Uzivatel(username); return(user.Role == null ? new[] { Uzivatel.UserExists(username) ? "authorized" : "" } : new string[] { user.Role.Identificator, "authorized" }); }