public IActionResult Index() { var vm = new ListLocationViewModel() { Locations = _meetingService.ListLocations() }; return(View(vm)); }
public ActionResult Index(int? page, string sortOrder = "") { var model = new ListLocationViewModel(); var pageNumber = page ?? 1; // if no page was specified in the querystring, default to the first page (1) var locations = _locationRepository.GetAll(); model.NameSortParam = String.IsNullOrEmpty(sortOrder) ? "Name Desc" : ""; switch (sortOrder) { case "Name Desc": locations = locations.SortByName(1); break; default: locations = locations.SortByName(0); break; } model.Locations = new PagedList<Location>(locations, pageNumber, 25); return View(model); }