public static void Clean() { using (var repo = new AnimalRepo()) { foreach (var animal in repo.GetAll()) { repo.Delete(animal.Id); } } }
public PartialViewResult PartialIndex(int page, string search) { ViewBag.selectedPage = page; if (search != "") { var searchResult = repo.Search(search); ViewBag.pageCount = repo.getPageCount(searchResult.Count()); return(PartialView("_Index_2", repo.GetPageItems(page, searchResult))); } else { var result = repo.GetAll(); ViewBag.pageCount = repo.getPageCount(result.Count()); return(PartialView("_Index_2", repo.GetPageItems(page, result))); } }