//Logic for detail page // GET: Teams/Details/5 public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var id2 = id.GetValueOrDefault(); ViewModelTeamWaypoint vmTeam = new ViewModelTeamWaypoint(); vmTeam.Team = _teams.GetById(id2); var adventure = _sessions.GetByTeamId(id2); if (adventure == null) { vmTeam.AllWaypoint = null; return(View(vmTeam)); } vmTeam.AllWaypoint = _waypoints.GetAll().Where(w => w.AdventureID == adventure.AdventureID).ToList(); var team = await _context.Team .FirstOrDefaultAsync(m => m.TeamId == id); if (team == null) { return(NotFound()); } return(View(vmTeam)); }
//Logic for index page // GET: Teams public IActionResult Index() { ViewModelTeamWaypoint vmTeam = new ViewModelTeamWaypoint(); vmTeam.AllTeam = _teams.GetAll().ToList(); vmTeam.Team = _teams.GetById(1); vmTeam.AllWaypoint = _waypoints.GetAll().ToList(); return(View(vmTeam)); }