示例#1
0
        public void Update(Head2HeadWorldCup h2h)
        {
            var h2hModified = _mapper.Map <H2HWorldCup>(h2h);

            _ctx.H2HWorldCup.Attach(h2hModified);
            _ctx.Entry(h2hModified).State = EntityState.Modified;
        }
示例#2
0
        private void CompleteH2HWorldCup(Match match, ref Head2HeadWorldCup h2hTeam1, ref Head2HeadWorldCup h2hTeam2)
        {
            if (match.GoalsTeam1 > match.GoalsTeam2)
            {
                h2hTeam1.Wins++;
                h2hTeam2.Loses++;
            }
            else if (match.GoalsTeam2 > match.GoalsTeam1)
            {
                h2hTeam2.Wins++;
                h2hTeam1.Loses++;
            }
            else
            {
                h2hTeam1.Draws++;
                h2hTeam2.Draws++;
            }

            h2hTeam1.GamesPlayed++;
            h2hTeam1.GoalsFavor   += match.GoalsTeam1;
            h2hTeam1.GoalsAgainst += match.GoalsTeam2;

            h2hTeam2.GamesPlayed++;
            h2hTeam2.GoalsFavor   += match.GoalsTeam2;
            h2hTeam2.GoalsAgainst += match.GoalsTeam1;
        }
示例#3
0
 public async Task Update(Head2HeadWorldCup h2hWorldCup)
 {
     _h2HWorldCupRepository.Update(h2hWorldCup);
     await _h2HWorldCupRepository.SaveChanges();
 }
示例#4
0
        public async Task Add(Head2HeadWorldCup h2hWorldCup)
        {
            await _h2HWorldCupRepository.Add(h2hWorldCup);

            await _h2HWorldCupRepository.SaveChanges();
        }
示例#5
0
 public async Task Add(Head2HeadWorldCup h2h)
 {
     var h2hToAdd = _mapper.Map <H2HWorldCup>(h2h);
     await _ctx.H2HWorldCup.AddAsync(h2hToAdd);
 }