예제 #1
0
        public ActionResult Detail(int?id)
        {
            if (!id.HasValue || id == 0)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var game = context.Games.Where(a => a.GameId == id).FirstOrDefault();
            ObserveController obs = new ObserveController();

            if (obs.IsInObserverGame(game.GameId))
            {
                game.IsInObserver = true;
            }
            return(View(game));
        }
예제 #2
0
        // GET: Game
        public ActionResult Index(string nameOfGameCategory = null)
        {
            var games = nameOfGameCategory != null?context.Games.Where(a => a.Category.Name == nameOfGameCategory).ToList() :
                            context.Games.ToList();

            ObserveController obs = new ObserveController();

            games.ForEach(a =>
            {
                if (obs.IsInObserverGame(a.GameId))
                {
                    a.IsInObserver = true;
                }
            });


            return(View(games));
        }