示例#1
0
        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));
        }
示例#2
0
        // GET: ManageComments
        public ActionResult Index()
        {
            var comments = _comments.GetAll(null);

            return(View(comments));
        }