public IActionResult All(string search = "", int page = 1) { if (string.IsNullOrEmpty(search)) { search = ""; } var totalParts = this.parts.Total(search); var allParts = new PartsListViewModel { Search = search, Parts = parts.AllParts(search, page, pageSize), CurrentPage = page, TotalPages = (int)Math.Ceiling(totalParts / (double)pageSize) }; return(View(allParts)); }