public GameController(GameService gameService, SpotService spotService, RewardService rewardService, IntersectionGameSpotService intersectionGameSpotService, IntersectionGameRewardService intersectionGameRewardService) { GameService = gameService; SpotService = spotService; RewardService = rewardService; IntersectionGameSpotService = intersectionGameSpotService; IntersectionGameRewardService = intersectionGameRewardService; }
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)); }
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); } } } }