Esempio n. 1
0
        // GET: Authors
        public ActionResult Index(int?page, string sort = "", string sortdir = "")
        {
            const int pageSize   = 2;
            var       pageNumber = page.HasValue ? page.Value : 1;

            ViewBag.Count       = service.Count();
            ViewBag.CurrentPage = pageNumber;
            decimal x = ViewBag.Count / pageSize;

            if (x * pageSize < ViewBag.Count)
            {
                ViewBag.TotalPages = x + 1;
            }
            else
            {
                ViewBag.TotalPages = x;
            }

            ViewBag.PageSize = pageSize;

            List <AuthorModel> authorList = new List <AuthorModel>();
            var authorDbList = service.GetAuthors(pageNumber, pageSize, "FirstName", " ");

            authorList.InjectFrom(authorDbList);

            return(View(authorList));
        }
Esempio n. 2
0
 public IActionResult Count() => _authorService.Count();