Ejemplo n.º 1
0
        public async Task <List <TableDto> > AddOrUpdateMatches(List <MatchDto> matches)
        {
            foreach (var match in matches)
            {
                if (_db.Matches.Any(x =>
                                    x.LeagueTitle == match.LeagueTitle &&
                                    x.HomeTeam == match.HomeTeam &&
                                    x.AwayTeam == match.AwayTeam))
                {
                    await RemoveMatch(match);
                }
                _db.Matches.Add(Mapper.Map <Match>(match));
                await _tableService.AddOrUpdateTable(match);

                await _db.SaveChangesAsync();
            }
            return(await _tableService.GetTables());
        }