public ActionResult Index(string sortOrder, string currentFilter, string searchString, int?page) { var p = new ClienteApiProcess(); var lista = p.ToList(); ViewBag.CurrentSort = sortOrder; ViewBag.NameSortParm = string.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; var cliente = from s in lista select s; if (!string.IsNullOrEmpty(searchString)) { cliente = cliente.Where(s => s.Apellido.Contains(searchString)); } switch (sortOrder) { case "name_desc": cliente = cliente.OrderByDescending(s => s.Apellido); break; default: cliente = cliente.OrderBy(s => s.Apellido); break; } int pageSize = 5; int pageNumber = (page ?? 1); return(View(cliente.ToPagedList(pageNumber, pageSize))); //return View(db.ToList()); }
public ActionResult Index() { var p = new ClienteApiProcess(); return(View(p.ToList())); }