public RedirectToActionResult Add(TeamViewModel model) { model.Team = context.Teams .Include(t => t.Conference) .Include(t => t.Division) .Where(t => t.TeamID == model.Team.TeamID) .FirstOrDefault(); var session = new NFLSession(HttpContext.Session); var teams = session.GetMyTeams(); teams.Add(model.Team); session.SetMyTeams(teams); var cookies = new NFLCookies(HttpContext.Response.Cookies); cookies.SetMyTeamIds(teams); TempData["message"] = $"{model.Team.Name} added to your favorites"; return(RedirectToAction("Index", new { ActiveDiv = session.GetActiveDiv(), ActiveConf = session.GetActiveConf() })); }
public ViewResult Index() { var session = new NFLSession(HttpContext.Session); var model = new TeamListViewModel { ActiveConf = session.GetActiveConf(), ActiveDiv = session.GetActiveDiv(), Teams = session.GetMyTeams() }; return(View(model)); }
public IActionResult Index() { var session = new NFLSession(HttpContext.Session); var model = new TeamListViewModel { ActiveConference = session.GetActiveConference(), ActiveDivision = session.GetActiveDivision(), Teams = session.GetMyTeams() }; return(View(model)); }