public static void FillDatabaseWithMatches(this SoccerStatisticsDbContext dbContext) { dbContext.Add( new Match { Id = 1, AmountOfFans = 60_123, Date = new DateTime(2015, 3, 4), });
public static void FillDatabaseWithPlayers(this SoccerStatisticsDbContext dbContext) { dbContext.Players.Add( new Player() { Id = 1, Name = "Lionel", Surname = "Messi", Height = 169, Weight = 68, Birthday = new DateTime(1987, 6, 23), Nationality = "Argentina", DominantLeg = DominantLegType.Left, Nick = "La Pulga", Number = 10 }); dbContext.Players.Add( new Player() { Id = 2, Name = "Cristiano", Surname = "Rolando", Height = 189, Weight = 85, Birthday = new DateTime(1985, 2, 5), Nationality = "Portugal", DominantLeg = DominantLegType.Right, Nick = "CR7", Number = 7 }); dbContext.Players.Add( new Player() { Id = 3, Name = "Michał", Surname = "Pazdan", Height = 180, Weight = 78, Birthday = new DateTime(1987, 9, 21), Nationality = "Poland", DominantLeg = DominantLegType.Undefined, Nick = "Priest", Number = 22 }); dbContext.SaveChanges(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, SoccerStatisticsDbContext dbContext) { dbContext.Database.EnsureCreated(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "API V1"); }); }
public static void FillDatabaseWithTeams(this SoccerStatisticsDbContext dbContext) { dbContext.Teams.Add( new Team() { Id = 1, FullName = "Manchester United Football Club", ShortName = "Manchester United", City = "Stretford", CreatedAt = 1878, Coach = "Ole Gunnar Solskjær" }); dbContext.Teams.Add( new Team() { Id = 2, FullName = "Real Madrid Club de Futbol", ShortName = "Real Madrid", City = "Madrid", CreatedAt = 1902, Coach = "Zinedine Zidane" }); dbContext.Teams.Add( new Team() { Id = 3, FullName = "Futbol Club Barcelona", ShortName = "FC Barcelona", City = "Barcelona", CreatedAt = 1899, Coach = "Quique Setien" }); dbContext.SaveChanges(); }
public LeagueRepository(SoccerStatisticsDbContext context) { _context = context; }
public PlayerRepository(SoccerStatisticsDbContext context) { _context = context; }
public StadiumRepository(SoccerStatisticsDbContext context) { _context = context; }
public RoundRepository(SoccerStatisticsDbContext context) { _context = context; }
public MatchRepository(SoccerStatisticsDbContext dbContext) { _dbContext = dbContext; }