// // GET: /JavaScripts/ public ActionResult Index() { ViewBag.WelcomeMessage = "Javascript Page"; ZooViewModel zoo = new ZooViewModel(); return View(zoo); }
public ActionResult SearchAnimal(string name, string AnimalClass) { ZooViewModel zoo = new ZooViewModel(); if (name == "") { zoo.LoadAnimals = zoo.Animals .Where(row => row.Type == AnimalClass) .ToList(); } else { zoo.LoadAnimals = zoo.Animals .Where(row => string.Equals(row.Name, name, StringComparison.OrdinalIgnoreCase) && row.Type == AnimalClass) .ToList(); } return PartialView("_SearchAnimal", zoo); }
// // GET: /Pagination/ public ActionResult Index(int page = 1) { ViewBag.WelcomeMessage = "Resco.Library - Pagination!"; ZooViewModel zoo = new ZooViewModel(); int itemsPerPage = 4; int totalItems = zoo.Animals.Count; int range = 5; zoo.LoadAnimals = zoo.Animals .Skip((page - 1) * itemsPerPage) .Take(itemsPerPage) .ToList(); zoo.Page = new Pagination().Pager(page, Convert.ToString(itemsPerPage), totalItems, range); zoo.Page.TotalItems = totalItems; zoo.Page.ShowList = new int[]{ 10, 25, 50, 75, 100 }; return View(zoo); }