Example #1
0
        public async Task <IActionResult> Index(string?fruit, int pagina = 1)
        {
            if (fruit != null)
            {
                return(View(_mapper.Map <List <FruitViewModel> >(await _fruitService.Search(f => f.Name.Contains(fruit))).ToPagedList(pagina, 5)));
            }

            return(View(_mapper.Map <List <FruitViewModel> >(await _fruitService.GetAll()).ToPagedList(pagina, 5)));
        }