Пример #1
0
        public static GenreIndexModel GetGenreIndexModel()
        {
            GenreIndexModel model = new GenreIndexModel();

            model.Genres = manager.listService.GetAllGenres().OrderBy(e => e.Name).Select(GetGenreModel);
            return(model);
        }
Пример #2
0
        public IActionResult Index(int id)
        {
            var books = _bookService.GetBooksByCondition(b => b.GenreId == id);

            var bookList = books.Select(b => new BookListingModel {
                BookId   = b.BookId,
                ImageUrl = b.ImageUrl
            });
            var model = new GenreIndexModel {
                BookList  = bookList,
                GenreName = _repositoryWrapper.GenreRepository.FindByCondition(g => g.Id == id).FirstOrDefault().Name
            };

            return(View(model));
        }
Пример #3
0
        public async Task <IActionResult> Index()
        {
            ICollection <Genre> genreModel = await _genres.GetAll();

            var listingResults = genreModel
                                 .Select(result => new GenreIndexListingModel
            {
                Id   = result.Id,
                Name = result.Name
            });

            var model = new GenreIndexModel()
            {
                Genres = listingResults
            };

            return(View(model));
        }