Exemplo n.º 1
0
        public ActionResult Home(int val)
        {
            ViewData["logged"] = false;

            List <Post> posts = SqlController.retrievePost("admin");

            posts             = posts.OrderByDescending(e => e.rawDate.Date).ThenByDescending(e => e.rawDate.TimeOfDay).ToList <Post>();
            ViewData["posts"] = posts;

            if (val <= 0)
            {
                ViewData["page"] = 1;
            }
            else
            {
                if (val > (posts.Count() / 10) + 1)
                {
                    ViewData["page"] = (posts.Count / 10) + 1;
                }
                else
                {
                    ViewData["page"] = val;
                }
            }

            if (Session["user"] != null)
            {
                ViewData["logged"] = true;
            }

            return(View());
        }
Exemplo n.º 2
0
        public ActionResult Home()
        {
            ViewData["logged"] = false;
            ViewData["page"]   = 1;

            List <Post> posts = SqlController.retrievePost("admin");

            posts             = posts.OrderByDescending(e => e.rawDate.Date).ThenByDescending(e => e.rawDate.TimeOfDay).ToList <Post>();
            ViewData["posts"] = posts;

            if (Session["user"] != null)
            {
                ViewData["logged"] = true;
            }

            return(View());
        }