public ActionResult Index(int?counter) { var model = new MainListViewModel(); var animals = _animals.GetAll(); foreach (var animal in animals) { var animalID = animal.Id; animal.UglyComments = _uglyComments.GetAll(animalID); animal.NewComment = new UglyCommentModel { AnimalId = animalID }; } if (counter.HasValue && counter != 0 && counter != 1) { model.PageCounter = counter.Value; model.Animals = animals.Skip(3 * (counter.Value - 1)).Take(3).ToList(); return(View(model)); } model.PageCounter = 1; model.Animals = animals.Take(3).ToList(); return(View(model)); }
// GET: ManageComments public ActionResult Index() { var comments = _comments.GetAll(null); return(View(comments)); }