//// GET: Food //public ActionResult Index() //{ // return View(); //} public ViewResult List(string category, int page = 1) { FoodsListViewModel model = new FoodsListViewModel { currentCategory = category, PagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = PageSize, TotalItems = FoodsRepository.FoodsList.Where(f => category == null || f.Category == category).Count() }, Foods = FoodsRepository.FoodsList .Where(f => category == null || f.Category == category) .OrderBy(f => f.FoodId) .Skip((page - 1) * PageSize) .Take(PageSize) }; return(View(model)); }
public FoodsListView() { InitializeComponent(); _viewModel = new FoodsListViewModel(); BindingContext = _viewModel; }