Ejemplo n.º 1
0
        public IActionResult AddGame()
        {
            AddGameViewModel addGameViewModel = new AddGameViewModel
            {
                Spots   = SpotService.GetAllSpots(),
                Rewards = RewardService.GetAllRewards(),
            };

            return(View(addGameViewModel));
        }
Ejemplo n.º 2
0
        public IActionResult Edit(Guid Id)
        {
            EditGameViewModel EditGameViewModel = new EditGameViewModel
            {
                Spots   = SpotService.GetAllSpots(),
                Rewards = RewardService.GetAllRewards(),
                IntersectionGameSpots   = IntersectionGameSpotService.GetAllIntersections(),
                IntersectionGameRewards = IntersectionGameRewardService.GetAllIntersections(),
                GameModel = GameService.GetGameFromGameId(Id)
            };

            return(View(EditGameViewModel));
        }
Ejemplo n.º 3
0
        private void LinkGameToSpots(ICollection <string> formKeys, GameModel game)
        {
            List <Spot> allSpots = SpotService.GetAllSpots();

            foreach (string key in formKeys)
            {
                foreach (Spot spot in allSpots)
                {
                    if (spot.Id.ToString() == key)
                    {
                        IntersectionGameSpot intersectionGameSpot = new IntersectionGameSpot
                        {
                            GameId = game.Id,
                            SpotId = spot.Id
                        };
                        IntersectionGameSpotService.AddIntersection(intersectionGameSpot);
                    }
                }
            }
        }