示例#1
0
        private async Task EnsurePicksExistAsync(List <PickEmLeagueDatabase.Entities.Game> games,
                                                 PickEmLeagueDatabase.Entities.User user, int week)
        {
            var currentPicks = _mapper.Map <IEnumerable <GamePick> >(
                _gamePickRepository.GetByUserAndWeek(user.Id, week)).ToList();

            foreach (var game in games)
            {
                if (currentPicks.Find(p => p.Game.Id == game.Id) == null)
                {
                    await _gamePickRepository.CreateAsync(game, user);
                }
            }
        }
 private async Task CreateGamePick(Game game, User user)
 {
     await _gamePickRepository.CreateAsync(game, user);
 }