public ViewResult Show(string sortOrder, string currentFilter, string searchString, int?page) { ViewBag.CurrentSort = sortOrder; ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; List <Transfer> transfers = transferManager.GetAll().ToList(); var transfer = from s in transfers select s; if (!String.IsNullOrEmpty(searchString)) { transfer = transfer.Where(s => s.EmployeeToTransfer.Contains(searchString)); } switch (sortOrder) { case "name_desc": transfer = transfer.OrderByDescending(s => s.EmployeeToTransfer); break; default: // Name ascending transfer = transfer.OrderBy(s => s.EmployeeToTransfer); break; } int pageSize = 10; int pageNumber = (page ?? 1); return(View(transfer.ToPagedList(pageNumber, pageSize))); }
public IActionResult Get() { IEnumerable <Transfer> transfer = transferManager.GetAll(); return(Ok(transfer)); }