public ActionResult Index(string sortOrder, string currentFilter, string searchString, int?page) { ViewBag.CurrentSort = sortOrder; ViewBag.NomeParam = String.IsNullOrEmpty(sortOrder) ? "Nome_desc" : ""; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; var especies = from m in repoEspecie.GetAll().ToList() select m; if (!String.IsNullOrEmpty(searchString)) { especies = especies.Where(s => s.Descricao.ToUpper().Contains(searchString.ToUpper())); } int pageSize = 20; int pageNumber = (page ?? 1); return(View(especies.ToPagedList(pageNumber, pageSize))); }
public ActionResult Create() { ViewBag.EspecieId = new SelectList(repoEspecie.GetAll(), "Id", "Descricao"); return(View()); }