Beispiel #1
0
        static void Main(string[] args)
        {
            List <RecordLabel> RecordLabels = new List <RecordLabel>();
            List <Song>        Songs        = new List <Song>();

            using (var db = new IndustryDbContext())
            {
                db.Database.EnsureDeleted();
                db.Database.EnsureCreated();

                RecordLabels = db.RecordLabels.Include("Songs").ToList();
                Songs        = db.Songs.Include("RecordLabel").ToList();

                RecordLabels.ForEach(label => Console.WriteLine(label.RecordLabelName));
                Songs.ForEach(song => Console.WriteLine($"{song.SongName} by {song.SongArtist}"));
            }
        }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IndustryDbContext db)
        {
            db.Database.EnsureDeleted();
            db.Database.EnsureCreated();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Beispiel #3
0
 public RecordLabelsController(IndustryDbContext context)
 {
     _context = context;
 }
 public SongsController(IndustryDbContext context)
 {
     _context = context;
 }