// 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)); }
public IActionResult Count() => _authorService.Count();