コード例 #1
0
 public EpisodeRepository(
     FallGuysContext fallGuysContext,
     ILogger <EpisodeRepository> logger
     )
 {
     _fallGuysContext = fallGuysContext;
     _logger          = logger;
 }
コード例 #2
0
        private void btnTest_Click(object sender, RoutedEventArgs e)
        {
            var optionsBuilder = new DbContextOptionsBuilder <FallGuysContext>();

            optionsBuilder.UseSqlite(@"Data Source=C:\Users\leekydesu\source\repos\FallGuyStats-Api\FallGuyStats\fallguys.db");
            using (var context = new FallGuysContext(optionsBuilder.Options))
            {
                var foundEpisode = context.Episodes.First();
                boxResults.Text = $"{foundEpisode.Id}, {foundEpisode.Created}, {foundEpisode.EpisodeFinished}, {foundEpisode.Crowns}, {foundEpisode.Fame}, {foundEpisode.Kudos}, {foundEpisode.Season}\r\n\r\n";
                var roundsFromEpisode = context.Rounds.Where(round => round.EpisodeId == foundEpisode.Id);
                foreach (var episodeRound in roundsFromEpisode)
                {
                    boxResults.Text += $"{episodeRound.Id}, {episodeRound.EpisodeId}, {episodeRound.RoundType}, {episodeRound.Qualified}, {episodeRound.Kudos}, {episodeRound.Badge}\r\n";
                }
            }
        }
コード例 #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, FallGuysContext fallGuysContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            fallGuysContext.Database.EnsureCreated();

            //app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseCors(AllowLocalOrigins);

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            app.UseStaticFiles();
            app.UseSpaStaticFiles();

            app.UseSpa(spa =>
            {
                // To learn more about options for serving an Angular SPA from ASP.NET Core,
                // see https://go.microsoft.com/fwlink/?linkid=864501

                spa.Options.SourcePath = "Angular";

                if (env.IsDevelopment())
                {
                    spa.UseAngularCliServer(npmScript: "start");
                }
            });
        }
コード例 #4
0
 public EpisodesController(
     FallGuysContext context
     )
 {
     _context = context;
 }
コード例 #5
0
 public RoundsController(FallGuysContext context)
 {
     _context = context;
 }