Example #1
0
        public IActionResult Index()
        {
            var assetModels = _assetsService.GetAll();

            var listingResult = assetModels
                                .Select(a => new AssetIndexListingModel
            {
                Id               = a.Id,
                ImageUrl         = a.ImageUrl,
                AuthorOrDirector = _assetsService.GetAuthorOrDirector(a.Id),
                Dewey            = _assetsService.GetDeweyIndex(a.Id),
                CopiesAvailable  = _checkoutsService.GetAvailableCopies(a.Id),
                Title            = _assetsService.GetTitle(a.Id),
                Type             = _assetsService.GetType(a.Id),
                NumberOfCopies   = _checkoutsService.GetNumberOfCopies(a.Id)
            }).ToList();

            var model = new AssetIndexModel
            {
                Assets = listingResult
            };

            return(View(model));
        }