public IEnumerable <Race> GetByTournamentId(Guid tournamentId) { using (var ctx = new FormulaDContext(_options)) { return(ctx.Set <Race>().GetRacesByTournmentId(tournamentId)?.ToList()); } }
public IEnumerable <TournamentStanding> GetTournamentStandingsById(Guid id) { using (var ctx = new FormulaDContext(_options)) { return(ctx.Set <TournamentStanding>().Where(ts => ts.TournamentId.Equals(id)).ToList()); } }
public IEnumerable <Tournament> FindByPartialName(string partialName) { using (var ctx = new FormulaDContext(_options)) { return(ctx.Set <Tournament>().ByPartialName(partialName).ToList()); } }
public Race GetById(Guid id) { using (var ctx = new FormulaDContext(_options)) { return(ctx.Set <Race>().SingleOrDefault(r => r.Id.Equals(id))); } }
public Racer GetByName(string name) { using (var ctx = new FormulaDContext(_options)) { return(ctx.Set <Racer>().SingleOrDefault(r => r.Username.Equals(name, StringComparison.OrdinalIgnoreCase))); } }
public Tournament FindByName(string name) { using (var ctx = new FormulaDContext(_options)) { return(ctx.Set <Tournament>() .SingleOrDefault(t => t.Name.Equals(name))); } }
public Tournament GetById(Guid id) { using (var ctx = new FormulaDContext(_options)) { return(ctx.Set <Tournament>() .SingleOrDefault(t => t.Id.Equals(id))); } }
public RaceStanding AddRaceStanding(RaceStanding raceStanding) { using (var ctx = new FormulaDContext(_options)){ ctx.Set <RaceStanding>().Add(raceStanding); ctx.SaveChanges(); return(raceStanding); } }
public Racer CreateRacer(string name) { using (var ctx = new FormulaDContext(_options)) { var racer = new Racer { Id = Guid.NewGuid(), Username = name }; ctx.Set <Racer>().Add(racer); ctx.SaveChanges(); return(racer); } }
public Tournament CreateTournament(string name, int raceCount) { var tournament = new Tournament { Id = Guid.NewGuid(), Name = name, RaceCount = raceCount, StartDate = DateTime.Now }; using (var ctx = new FormulaDContext(_options)) { ctx.Set <Tournament>().Add(tournament); ctx.SaveChanges(); } return(tournament); }
public Race CreateRace(Guid tournamentId, string track, int laps) { using (var ctx = new FormulaDContext(_options)) { var race = new Race { Id = Guid.NewGuid(), TournamentId = tournamentId, Track = track, Laps = laps, RaceDate = DateTime.Now }; ctx.Set <Race>().Add(race); ctx.SaveChanges(); return(race); } }