// GET: Games public ActionResult Index(int?page) { int itemsOnPage = 4; int pg = page.HasValue ? page.Value : 1; int totalGames; GameDao gameDao = new GameDao(); IList <Game> games = gameDao.GetGamesPaged(itemsOnPage, pg, out totalGames); ViewBag.Pages = (int)Math.Ceiling((double)totalGames / (double)itemsOnPage); ViewBag.CurrentPage = pg; ViewBag.Categories = new GameCategoryDao().GetAll(); HernaUser user = new HernaUserDao().GetByLogin(User.Identity.Name); if (user.Role.Identificator == "hrac") { return(View("IndexHrac", games)); } if (Request.IsAjaxRequest()) { return(PartialView(games)); } return(View(games)); }