// GET: Admin/Machine public ActionResult Index(int?page, int?item) { int itemsOnPage = item ?? 5; int pg = page ?? 1; MachineDao mDao = new MachineDao(); IList <Machine> machs = mDao.GetMachinePage(itemsOnPage, pg); UserDao uDao = new UserDao(); FitnessUser u = uDao.GetByLogin(User.Identity.Name); ViewBag.Pages = (int)Math.Ceiling((double)mDao.GetAll().Count / (double)itemsOnPage); ViewBag.CurrentPage = pg; ViewBag.Items = itemsOnPage; ViewBag.Mark = "Machine"; if (Request.IsAjaxRequest()) { if (u.Role.Name != "Údržbář") { return(PartialView("CustomerIndex", machs)); } return(PartialView(machs)); } else { if (u.Role.Name != "Údržbář") { return(View("CustomerIndex", machs)); } return(View(machs)); } }
// GET: Machine public ActionResult Index(int?page, int?item) { int itemsOnPage = item ?? 5; int pg = page ?? 1; MachineDao mDao = new MachineDao(); IList <Machine> machs = mDao.GetMachinePage(itemsOnPage, pg); ViewBag.Pages = (int)Math.Ceiling((double)mDao.GetAll().Count / (double)itemsOnPage); ViewBag.CurrentPage = pg; ViewBag.Items = itemsOnPage; ViewBag.Mark = "Machine"; if (Request.IsAjaxRequest()) { return(PartialView(machs)); } return(View(machs)); }