Beispiel #1
0
        public RedirectToActionResult Add(OlympicViewModel model)
        {
            model.Country = context.Countries
                            .Include(t => t.Game)
                            .Include(t => t.Sport)
                            .Where(t => t.CountryID == model.Country.CountryID)
                            .FirstOrDefault();

            var session   = new CountrySession(HttpContext.Session);
            var countries = session.GetMyCountries();

            countries.Add(model.Country);
            session.SetMyCountries(countries);

            var cookies = new CountryCookies(Response.Cookies);

            cookies.SetMyCountryIds(countries);

            TempData["message"] = $"{model.Country.CountryName} added to favorites";

            return(RedirectToAction("Index",
                                    new
            {
                ActiveGame = session.GetActiveGame(),
                ActiveSport = session.GetActiveSport()
            }));
        }
Beispiel #2
0
        public RedirectToActionResult Add(CountryViewModel model)
        {
            model.Country = context.Countries
                            .Include(c => c.Game)
                            .Include(c => c.Sport)
                            .Include(c => c.Category)
                            .Where(c => c.CountryId == model.Country.CountryId)
                            .FirstOrDefault();

            var session   = new CountrySession(HttpContext.Session);
            var Countries = session.GetMyCountries();

            Countries.Add(model.Country);
            session.SetMyCountries(Countries);

            var cookies = new CountryCookies(HttpContext.Response.Cookies);

            cookies.SetMyCountryIds(Countries);

            TempData["message"] = $"{model.Country.Name} added to your favorites";

            return(RedirectToAction("Index",
                                    new
            {
                ActiveGame = session.GetActiveGame(),
                ActiveSport = session.GetActiveSport(),
                ActiveCategory = session.GetActiveCategory()
            }));
        }
Beispiel #3
0
        public ViewResult Details(string id)
        {
            var session = new CountrySession(HttpContext.Session);
            var model   = new CountryViewModel {
                Country    = context.Countries.Include(t => t.GameType).Include(t => t.Category).FirstOrDefault(t => t.CountryId == id),
                ActiveGame = session.GetActiveGame(),
                ActiveCat  = session.GetActiveCat()
            };

            return(View(model));
        }
        public RedirectToActionResult Change(CountryListViewModel model)
        {
            var session = new CountrySession(HttpContext.Session);

            session.SetName(model.UserName);
            return(RedirectToAction("Index", "Home", new
            {
                ActiveGame = session.GetActiveGame(),
                ActiveSport = session.GetActiveSport(),
                ActiveCategory = session.GetActiveCategory()
            }));
        }
Beispiel #5
0
        public ViewResult Index()
        {
            var session = new CountrySession(HttpContext.Session);
            var model   = new CountryListViewModel
            {
                ActiveGame = session.GetActiveGame(),
                ActiveCat  = session.GetActiveCat(),
                Countries  = session.GetMyCountries()
            };

            return(View(model));
        }
        public RedirectToActionResult Delete()
        {
            var session = new CountrySession(HttpContext.Session);
            var cookies = new CountryCookies(Response.Cookies);

            session.RemoveMyCountries();
            cookies.RemoveMyCountryIds();

            TempData["message"] = "Favorite countries cleared";

            return(RedirectToAction("Index", "Country", new { ActiveGame = session.GetActiveGame(), ActiveCat = session.GetActiveCat() }));
        }
Beispiel #7
0
        public RedirectToActionResult Delete()
        {
            var session = new CountrySession(HttpContext.Session);

            session.RemoveMyTeams();

            TempData["message"] = "Favorite teams cleared";

            return(RedirectToAction("Index", "Home",
                                    new
            {
                ActiveGame = session.GetActiveGame(),
                ActiveCat = session.GetActiveCat()
            }));
        }
Beispiel #8
0
        public ViewResult Details(string id)
        {
            var session = new CountrySession(HttpContext.Session);
            var model   = new OlympicViewModel
            {
                Country = context.Countries
                          .Include(t => t.Game)
                          .Include(t => t.Sport)
                          .FirstOrDefault(t => t.CountryID == id),
                ActiveSport = session.GetActiveGame(),
                ActiveGame  = session.GetActiveSport()
            };

            return(View(model));
        }
Beispiel #9
0
        public IActionResult Details(string id)
        {
            var session = new CountrySession(HttpContext.Session);
            var model   = new CountryViewModel
            {
                Country = context.Countries
                          .Include(c => c.Game)
                          .Include(c => c.Sport)
                          .Include(c => c.Category)
                          .FirstOrDefault(c => c.CountryId == id),
                ActiveSport    = session.GetActiveSport(),
                ActiveGame     = session.GetActiveGame(),
                ActiveCategory = session.GetActiveCategory()
            };

            return(View(model));
        }
Beispiel #10
0
        public RedirectToActionResult Add(CountryViewModel model)
        {
            model.Country = context.Countries
                            .Include(c => c.Game)
                            .Include(c => c.Category)
                            .Where(c => c.CountryID == model.Country.CountryID)
                            .FirstOrDefault();

            var session   = new CountrySession(HttpContext.Session);
            var countries = session.GetMyCountries();

            countries.Add(model.Country);
            session.SetMyCountries(countries);

            return(RedirectToAction("Index",
                                    new
            {
                ActiveGame = session.GetActiveGame(),
                ActiveCat = session.GetActiveCat()
            }));
        }