public ViewResult List(string query = null)
        {
            FormatListViewModel model = new FormatListViewModel
            {
                Formats = repository.GetAllFormats().Where(b => query == null || b.FormatName == query)
            };

            return(View(model));
        }
        public ViewResult Edit(int tourId)
        {
            Tour tour = repository.GetAllTours().FirstOrDefault(b => b.TourId == tourId);

            TourEditViewModel model = new TourEditViewModel
            {
                Tour         = tour,
                Formats      = formatRepository.GetAllFormats(),
                CurentFormat = tour.FormatId
            };

            return(View(model));
        }
        // GET: Formats/Create
        public IActionResult Create()
        {
            var games   = _context.GetAllGames().ToList();
            var formats = _formatContext.GetAllFormats().ToList();

            var viewModel = new TournamentViewModel
            {
                Games   = games,
                Formats = formats
            };

            return(View(viewModel));
        }
        public IActionResult GameDetails(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var game = _gameRepository.GetGameByID(id);

            if (game == null)
            {
                return(NotFound());
            }

            var gameViewModel = new GameViewModel()
            {
                Game        = game,
                Formats     = _formatRepository.GetAllFormats().Where(f => f.GameID == game.GameID).ToList(),
                Tournaments = _tournamentRepository.GetAllTournaments().Where(f => f.GameID == game.GameID).ToList()
            };

            return(View(gameViewModel));
        }
 // GET: Formats
 public IActionResult Index()
 {
     return(View(_context.GetAllFormats()));
 }