public void Update(Head2HeadWorldCup h2h) { var h2hModified = _mapper.Map <H2HWorldCup>(h2h); _ctx.H2HWorldCup.Attach(h2hModified); _ctx.Entry(h2hModified).State = EntityState.Modified; }
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; }
public async Task Update(Head2HeadWorldCup h2hWorldCup) { _h2HWorldCupRepository.Update(h2hWorldCup); await _h2HWorldCupRepository.SaveChanges(); }
public async Task Add(Head2HeadWorldCup h2hWorldCup) { await _h2HWorldCupRepository.Add(h2hWorldCup); await _h2HWorldCupRepository.SaveChanges(); }
public async Task Add(Head2HeadWorldCup h2h) { var h2hToAdd = _mapper.Map <H2HWorldCup>(h2h); await _ctx.H2HWorldCup.AddAsync(h2hToAdd); }