using JXCMS.CMS.Attribute;
using JXCMS.CMS.Movie.Entity;
using Microsoft.AspNetCore.Mvc;

namespace JXCMS.CMS.Movie.Admin.Controllers
{
    [Area("Admin")]
    [AdminAuthentication]
    public class MovieController : Controller
    {
        public IActionResult Index(int pageNumber = 1, int pageSize = 20)
        {
            var model = MovieEntity.Select.Count(out long count).Page(pageNumber, pageSize)
                .Include(x => x.DirectorEntity).Include(x => x.ClassifyEntity).ToList();
            ViewBag.count = count;
            ViewBag.pageNumber = pageNumber;
            ViewBag.totlePage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
            return View(model);
        }
    }
}