Esempio n. 1
0
        public IActionResult Index()
        {
            var assetModels = _assets.GetAll();

            var listingResult = assetModels.Select(result => new AssetIndexListingModel
            {
                id               = result.Id,
                ImgUrl           = result.ImageUrl,
                Title            = result.Title,
                AuthorOrDirector = _assets.GetAuthorOrDirector(result.Id),
                DewyCallNumber   = _assets.GetDewyIndex(result.Id),
                Type             = _assets.GetType(result.Id),
            });

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

            return(View(model));
        }
Esempio n. 2
0
        public IActionResult Index(string title = "", string author = "")
        {
            var assetModels = _assets.GetAll()
                              .Where(a => (string.IsNullOrEmpty(title)) || (string.IsNullOrEmpty(author)) || _assets.GetAuthorOrDirecor(a.Id) == author || a.Title == title);

            var l = assetModels.Select(r => new AssetIndexListingModel
            {
                Id              = r.Id,
                ImageUrl        = r.ImageUrl,
                DeweyCallNumber = _assets.GetDewyIndex(r.Id),
                Type            = _assets.GetType(r.Id),
                Title           = r.Title
            }
                                       );
            var model = new AssetIndexModel()
            {
                Assets = l
            };

            return(View(model));
        }