Exemple #1
0
        public ActionResult CreateGame()
        {
            var gameViewModel = new CreateGameViewModel();

            var genresFromDb     = _genreManager.GetAllGenres().ToList();
            var platformsFromDb  = _platformManager.GetAllPlatforms().ToList();
            var publishersFromDb = _publisherManager.GetAllPublishers().ToList();

            gameViewModel.AllGenres     = new MultiSelectList(genresFromDb.OrderBy(i => i.Category), "Id", "Name", "Category");
            gameViewModel.AllPlatforms  = new MultiSelectList(platformsFromDb.OrderBy(i => i.Type), "Id", "Type");
            gameViewModel.AllPublishers = new MultiSelectList(publishersFromDb.OrderBy(i => i.CompanyName), "Id", "CompanyName");

            return(View("CreateGame", gameViewModel));
        }
Exemple #2
0
        public FilterViewModel(IGenreManager genreManager, IPlatformManager platformTypeManager,
                               IPublisherManager publisherManager)
        {
            _genreManager     = genreManager;
            _platformManager  = platformTypeManager;
            _publisherManager = publisherManager;

            SelectedGenres     = new List <int>();
            SelectedPlatforms  = new List <int>();
            SelectedPublishers = new List <int>();

            AllGenres = new MultiSelectList(_genreManager.GetAllGenres().OrderBy(g => g.Category), "Id", "Name",
                                            "Category");
            AllPlatforms = new MultiSelectList(_platformManager.GetAllPlatforms().OrderBy(g => g.Type), "Id", "Type");
            ;
            AllPublishers = new MultiSelectList(_publisherManager.GetAllPublishers().OrderBy(i => i.CompanyName), "Id",
                                                "CompanyName");

            ItemsPerPage = new SelectList(new List <string> {
                "2", "10", "20", "50", "100", "All"
            });
            //FilterByOptions = new SelectList();
            //WhenPublished = new SelectList();
        }