public async Task <IActionResult> Index(int id = 1) { var listOfIngredients = new IngredientsListViewModel(); listOfIngredients.Paging.Count = await ingredientServices.AllIngredientsCountAsync(); listOfIngredients.Paging.ItemsPerPage = itemsPerPage; listOfIngredients.Paging.CurrentPage = id; listOfIngredients.Ingredients = (await ingredientServices.GetAllPagedDTOAsync(listOfIngredients.Paging.ItemsPerPage, listOfIngredients.Paging.CurrentPage)) .Select(c => c.MapToViewModel()); return(View(listOfIngredients)); }