public RedirectToActionResult Change(TeamListViewModel model) { var session = new NFLSession(HttpContext.Session); session.SetName(model.UserName); return(RedirectToAction("Index", "Home", new { ActiveConf = session.GetActiveConf(), ActiveDiv = session.GetActiveDiv() })); }
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 RedirectToActionResult ClearAllSessions() { var session = new NFLSession(HttpContext.Session); session.ClearSessions(); return(RedirectToAction("Index", new { ActiveConf = session.GetActiveConf(), ActiveDiv = session.GetActiveDiv() })); }
public RedirectToActionResult Delete() { var session = new NFLSession(HttpContext.Session); var cookies = new NFLCookies(Response.Cookies); session.RemoveMyTeams(); cookies.RemoveMyTeamsIDs(); TempData["message"] = "Favorite Teams are cleared"; return(RedirectToAction("Index", "Home", new { activeConf = session.GetActiveConf(), activeDiv = session.GetActiveDiv() })); }
public RedirectToActionResult Delete() { var session = new NFLSession(HttpContext.Session); session.RemoveMyTeams(); TempData["message"] = "Favorite teams cleared"; return(RedirectToAction("Index", "Home", new { ActiveConf = session.GetActiveConf(), ActiveDiv = session.GetActiveDiv() })); }
public IActionResult Details(string id) { var session = new NFLSession(HttpContext.Session); var model = new TeamViewModel { Team = context.Teams .Include(t => t.Conference) .Include(t => t.Division) .FirstOrDefault(t => t.TeamID == id), ActiveDiv = session.GetActiveDiv(), ActiveConf = session.GetActiveConf() }; return(View(model)); }
public RedirectToActionResult Add(TeamViewModel model) { model.Team = context.Teams .Include(c => c.Conference) .Include(d => d.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(Response.Cookies); cookies.SetMyTeamIDs(teams); TempData["message"] = $"{model.Team.Name} was added to your favorites"; return(RedirectToAction("Index", new { activeConf = session.GetActiveConf(), activeDiv = session.GetActiveDiv() })); }
public RedirectToActionResult Add(TeamViewModel data) { data.Team = context.Teams .Include(t => t.Conference) .Include(t => t.Division) .Where(t => t.TeamID == data.Team.TeamID) .FirstOrDefault(); var session = new NFLSession(HttpContext.Session); var teams = session.GetMyTeams(); teams.Add(data.Team); session.SetMyTeams(teams); TempData["message"] = $"{data.Team.Name} added to your favorites"; return(RedirectToAction("Index", new { ActiveConf = session.GetActiveConf(), ActiveDiv = session.GetActiveDiv() })); }