Пример #1
0
        // 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());
        }
Пример #2
0
        // 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));
        }