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

            _styles = _styleRepository.Take(0, (_styleRepository.Count() <= lengthPage) ? _styleRepository.Count() : lengthPage).Select(vm => new StylesViewModel {
                IdStyle = vm.IdStyle, Libelle = vm.Libelle
            }).ToList();

            IndexStylesViewModel indexStylesViewModel = new IndexStylesViewModel
            {
                Styles      = _styles,
                TotalStyles = _styleRepository.Count(),
                PageActuel  = 1,
                LengthPage  = lengthPage,
                DisplayPage = displayPage,
                Next        = (_styleRepository.Count() - lengthPage > 0) ? true : false
            };

            return(this.View(nameof(StylesController.Index), indexStylesViewModel));
        }
Beispiel #2
0
 public IViewComponentResult Invoke(IndexStylesViewModel pagination)
 {
     return(View(pagination));
 }