public ActionResult Index(String search, int page = 1) { var rols = (byte[])Session["rols"]; if (rols == null) //redirect to SinIn { return(RedirectToAction("Index", "Home")); } else if (rols.Contains <byte>(2) || rols.Contains <byte>(1)) { IEnumerable <data.product> listProducts = null; if (search == "" || search == null) { listProducts = _products.GetAll(); } else { listProducts = _products.GetByNameOrId(search); } ViewBag.Search = search; PagedList <data.product> model = new PagedList <data.product>(listProducts, page, 8); return(View(model)); } else//redirect to Home { return(RedirectToAction("Home", "Home")); } }