예제 #1
0
        public async Task <IActionResult> Index(int pageNumber = FilmsCatalogModelsConstants.PAGE_NUMBER,
                                                int pageSize   = FilmsCatalogModelsConstants.PAGE_SIZE)
        {
            var films = await _filmsService.ListFilms(pageNumber, pageSize);

            foreach (var film in films)
            {
                film.IsEditingAllowed = GetIsEditingAllowed(film.CreatedByUserId);
            }

            FilmsViewModel model = new FilmsViewModel
            {
                Films           = films,
                IsAuthenticated = User.Identity.IsAuthenticated,
                PageNumber      = pageNumber,
                PageSize        = pageSize,
                AllCount        = await _filmsService.GetAllFilmsCount()
            };

            return(base.View(model));
        }