private void LinkGameToRewards(ICollection <string> formKeys, GameModel game) { List <Reward> allRewards = RewardService.GetAllRewards(); foreach (string key in formKeys) { foreach (Reward reward in allRewards) { if (reward.Id.ToString() == key) { IntersectionGameReward intersectionGameReward = new IntersectionGameReward { GameId = game.Id, RewardId = reward.Id }; IntersectionGameRewardService.AddIntersection(intersectionGameReward); } } } }
public void AddIntersection(IntersectionGameReward intersectionGameReward) { IntersectionGameRewardRepository.AddIntersection(intersectionGameReward); }
public void AddIntersection(IntersectionGameReward intersectionGameReward) { GameContext.Add(intersectionGameReward); GameContext.SaveChanges(); }