public async Task <PlayerEvent> InsertPlayerEvent(PlayerEvent playerEvent) { await _context.PlayerEvents.AddAsync(playerEvent); await _context.SaveChangesAsync(); return(playerEvent); }
public async Task <PlayerRating> Insert(PlayerRating playerRating) { await _context.PlayerRatings.AddAsync(playerRating); await _context.SaveChangesAsync(); return(playerRating); }
public async Task <RatingJob> Insert(RatingJob job) { await _context.RatingJobs.AddAsync(job); await _context.SaveChangesAsync(); return(job); }
public async Task DeleteDailyRatingByPlayerId(int playerId) { var history = _context.DailyRatings.Include(w => w.PlayerRating) .Where(w => w.PlayerRating.PlayerId == playerId); _context.DailyRatings.RemoveRange(history); await _context.SaveChangesAsync(); }
public async Task AddOrUpdateSubRating(SubRating subRating) { var existing = await _context.SubRatings .FirstOrDefaultAsync(s => s.PlayerRatingId == subRating.PlayerRatingId); if (existing != null) { existing.DateLastUpdated = DateTime.Now; existing.HardCourt = subRating.HardCourt; existing.ClayCourt = subRating.ClayCourt; existing.GrassCourt = subRating.GrassCourt; existing.OneMonth = subRating.OneMonth; existing.ThreeMonth = subRating.ThreeMonth; existing.EightWeek = subRating.EightWeek; existing.SixWeek = subRating.SixWeek; existing.GrandSlamMasters = subRating.GrandSlamMasters; existing.ResultCount = subRating.ResultCount; existing.HardCourtCount = subRating.HardCourtCount; existing.ClayCourtCount = subRating.ClayCourtCount; existing.GrassCourtCount = subRating.GrassCourtCount; existing.OneMonthCount = subRating.OneMonthCount; existing.ThreeMonthCount = subRating.ThreeMonthCount; existing.EightWeekCount = subRating.EightWeekCount; existing.SixWeekCount = subRating.SixWeekCount; existing.GrandSlamMastersCount = subRating.GrandSlamMastersCount; } else { subRating.DateCreated = DateTime.Now; subRating.DateLastUpdated = DateTime.Now; await _context.SubRatings.AddAsync(subRating); } await _context.SaveChangesAsync(); }
public async Task InsertList(List <RatingResult> resultRatings) { await _context.ResultRatings.AddRangeAsync(resultRatings); await _context.SaveChangesAsync(); }