// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, cinemaCoreContext context) { if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); DataBase.Initialize(context); }
public tarjetasController(cinemaCoreContext context) { _context = context; }
{ public static void Initialize(cinemaCoreContext context) { context.Database.EnsureCreated(); if (context.silla.Any()) { return; } var sillas = new silla[] { new silla { idSilla = 1, fila = 1, noSilla = 1, preferencial = true, sillaPaga = false } }; foreach (silla c in sillas) { context.silla.Add(c); } context.SaveChanges(); if (context.sala.Any()) { return; } var sala = new sala[] { new sala { noSala = 1, ingreso = 120000 } }; foreach (sala c in sala) { context.sala.Add(c); } context.SaveChanges(); if (context.tarjeta.Any()) { return; } var tarjeta = new tarjeta[] { new tarjeta { idTarjeta = 1, docPropietario = 1012558696, nombrePropietario = "Jorga Peña", recarga = 50000, saldo = 80000 } }; foreach (tarjeta c in tarjeta) { context.tarjeta.Add(c); } context.SaveChanges(); if (context.reserva.Any()) { return; } var reservas = new reserva[] { new reserva { idReserva = 1, docSolicitante = 1012458552, estadoPago = false, PagoConTarjeta = true, cantidadSillas = 2 } }; foreach (reserva c in reservas) { context.reserva.Add(c); } context.SaveChanges(); }
public sillasController(cinemaCoreContext context) { _context = context; }
public reservasController(cinemaCoreContext context) { _context = context; }