public IActionResult Index(int page = 1) { int pageSize = 1; // количество элементов на странице var source = repo.GetGoods(); var count = source.Count(); var items = source.Skip((page - 1) * pageSize).Take(pageSize).ToList(); PageViewModel pageViewModel = new PageViewModel(count, page, pageSize); IndexViewModel viewModel = new IndexViewModel { PageViewModel = pageViewModel, _Goods = items }; return(View(viewModel)); }
public async Task <List <Good> > Search(string text) { text = text.ToLower(); var searchedGoods = await _goodRepo.GetGoods(good => good.Name.ToLower().Contains(text)); return(searchedGoods); }