Пример #1
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));
        }