// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, EntertainmentContext entertainmentContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.EnsureCreatedOfContext <EntertainmentContext>(); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
static async System.Threading.Tasks.Task Main(string[] args) { using (var db = new EntertainmentContext()) { //Actor.AddActorToDbViaApi(new Actor { FirstName = "Mark", LastName = "Mcmorris", DateOfBirth = Convert.ToDateTime("04.11.1995") }); Movie.AddMovieToDbViaApi(new Movie { Title = "Inception on snowboard", ReleaseDate = Convert.ToDateTime("04.10.2000") }); //Actor actor1 = Actor.GetAllActorsFromAPI()[0]; //Actor.DeleteActorFromDbViaApi(actorSomSlettes); Console.WriteLine("Movies:"); foreach (Movie movie in Movie.GetAllMoviesFromApi()) { Console.WriteLine(movie.ToString()); } Console.WriteLine("\nActors:"); foreach (Actor actor in Actor.GetAllActorsFromAPI()) { Console.WriteLine(actor.ToString()); } } }
public MoviesController(EntertainmentContext context) { _context = context; }
public ActorsController(EntertainmentContext context) { _context = context; }