예제 #1
0
        public async Task <IActionResult> Index(int page = 1, int size = 10, string orderBy = "Name", bool order = true)
        {
            try
            {
                var cinemas = await cinemaService.GetPagedAsync(page - 1, size, orderBy, order);

                var count = await cinemaService.GetCountAsync();

                var dto = new PagerViewModel <CinemaIndexViewModel>()
                {
                    Items = mapper.Map <List <CinemaIndexViewModel> >(cinemas),
                    Pager = new Pager(page, size, orderBy, order, count)
                };

                return(View(dto));
            }
            catch
            {
                // TODO: Add proper error page and Log
                return(RedirectToAction("Index", "Home"));
            }
        }