예제 #1
0
        public IActionResult Index()
        {
            var assetModels   = _assets.GetAll();
            var listingResult = assetModels
                                .Select(result => new AssetIndexViewModel
            {
                Id             = result.Id,
                Title          = result.Title,
                Author         = _assets.GetAuthor(result.Id),
                NumberOfCopies = result.NumberOfCopies,
                BookIndex      = _assets.GetBookIndex(result.Id),
                ImageUrl       = result.ImageUrl,
                Type           = _assets.GetType(result.Id),
            });

            var model = new AssetIndexModel()
            {
                Assets = listingResult
            };

            return(View(model));
        }