public ActionResult Index(int id = 0) { if (id < 0) { throw new HttpException(404, "Could not find the requested page. Pagination number can't be negative !"); } var lastProblems = _problemRepository.All(id); var nbProblems = _problemRepository.Count(); return(View(new ProblemListModel { Problems = lastProblems, CurrentPage = id, NbProblemsTotal = nbProblems })); }