コード例 #1
0
        public IActionResult Index()
        {
            int lengthPage  = Convert.ToInt32(_configuration["lengthAdminPage"]);
            int displayPage = Convert.ToInt32(_configuration["displayAdminPage"]);

            _artistes = _artisteRepository.Take(0, (_artisteRepository.Count() <= lengthPage) ? _artisteRepository.Count() : lengthPage).Select(vm => new ArtisteViewModel {
                IdArtiste = vm.IdArtiste, NomArtiste = vm.Nom, DateNaissance = vm.DateNaissance
            }).ToList();

            IndexArtistesViewModel indexArtisteViewModel = new IndexArtistesViewModel
            {
                Artistes      = _artistes,
                TotalArtistes = _artisteRepository.Count(),
                PageActuel    = 1,
                LengthPage    = lengthPage,
                DisplayPage   = displayPage,
                Next          = (_artisteRepository.Count() - lengthPage > 0) ? true : false
            };

            return(this.View(nameof(ArtistesController.Index), indexArtisteViewModel));
        }
コード例 #2
0
 public IViewComponentResult Invoke(IndexArtistesViewModel pagination)
 {
     return(View(pagination));
 }