Пример #1
0
        public async Task <ActionResult> Index()
        {
            var dashboardViewModel = new DashboardViewModel()
            {
                TopBooksByPrice     = await _bookServices.GetAsync(orderBy : x => x.OrderByDescending(b => b.Price), page : 1, pageSize : 3),
                TopCategoriesByBook = await _categoryService.GetAsync(orderBy : x => x.OrderByDescending(b => b.Books.Count), page : 1, pageSize : 3),
                TopAuthorsByBook    = await _authorService.GetAsync(orderBy : x => x.OrderByDescending(b => b.Books.Count), page : 1, pageSize : 3),
                TopPublishersByBook = await _publisherService.GetAsync(orderBy : x => x.OrderByDescending(b => b.Books.Count), page : 1, pageSize : 3),
                TopBooksByComment   = await _bookServices.GetAsync(orderBy : x => x.OrderByDescending(b => b.Reviews.Count), page : 1, pageSize : 3),
                TotalBooks          = await _bookServices.CountAsync(),
                TotalCategories     = await _categoryService.CountAsync(),
                TotalAuthors        = await _authorService.CountAsync(),
                TotalPublishers     = await _publisherService.CountAsync(),
                TotalComments       = await _bookReviewService.CountAsync(),
            };

            return(View(dashboardViewModel));
        }