public IActionResult ByTitle(SearchByViewModel searchByViewModel)
        {
            if (ModelState.IsValid)
            {
                IEnumerable<Game> games = context.Games.Where(g => g.Title == searchByViewModel.Title);
                List<string> gameTitles = new List<string>();
         
                foreach (var game in games)
                {
                    gameTitles.Add(game.Title);
                }

                if (gameTitles.Contains(searchByViewModel.Title))
                {
                    SearchByViewModel viewModel = new SearchByViewModel(games);
                    return View(viewModel);
                }
                else
                {
                    ViewBag.ErrorMessage = "No games were found with that title.  Please search again.";
                    return View(searchByViewModel);
                }
            }

            return View(searchByViewModel);
        }
        public IActionResult ByPlatform()
        {
            List<Platform> platforms = context.Platforms.ToList();
            ViewBag.Platforms = platforms;

            SearchByViewModel searchByViewModel = new SearchByViewModel();
            return View(searchByViewModel);
        }
 public IActionResult ByPlatform(SearchByViewModel searchByViewModel)
 {
     IEnumerable<Game> games = context.Games.Where(g => g.PlatformId == searchByViewModel.PlatformId);
     SearchByViewModel viewModel = new SearchByViewModel(games);
     return View(viewModel);
 }
 public IActionResult ByTitle()
 {
     SearchByViewModel searchByViewModel = new SearchByViewModel();
     return View(searchByViewModel);
 }