public IActionResult Details(int id) { try { DetailsViewModel vm = new DetailsViewModel(); vm.Competition = repo.GetCompetition(id); vm.Drivers = repo.GetDrivers(); ViewBag.Reactions = repo.GetReactions(id); if (vm.Competition.Date < DateTime.Now) { vm.Results = repo.GetResultsFromRace(vm.Competition.ID); } ViewBag.CompetitionData = vm; PredictionViewModel p = new PredictionViewModel(); return(View(p)); } catch (Exception) { return(View("Error")); } }