def editUser(): idUser = request.form.get('idUser') name = request.form.get('name') lastname = request.form.get('lastname') mail = request.form.get('mail') password = request.form.get('password') user = User.SelectUserID(idUser) user.UpdateUser(name, lastname, mail, password) return redirect('/user')
def insertFlightUser(): idFlight = request.form.get('idFlight') idUser = request.form.get('idUser') seatNumber = request.form.get('seatNumber') flight = Flight.SelectFlightsID(idFlight) user = User.SelectUserID(idUser) seat = Seats.SelectSeatsID(seatNumber) flightUser = FlightUser(flight, user, seat) flightUser.InsertFlightUser() return redirect('/flightUser')
def reservarViaje(): idFlight = request.form.get('idFlight') idSeat = request.form.get('idSeat') flight = Flight.SelectFlightsID(idFlight) user = User.SelectUserID(session['idUser']) seat = Seats.SelectSeatsID(idSeat) flightUser = FlightUser(flight, user, seat) if flightUser not in FlightUser.SelectFlightUser(): flightUser.InsertFlightUser() return redirect('home')
def home(): active = False user = User('', '', '', '', '') if 'idUser' in session: active = True user = User.SelectUserID(session['idUser']) listaVuelosUser = FlightUser.SelectUsers(user.idUser) return render_template('UserHome.html', active=active, admin=user.administrador, listaVuelosUser=listaVuelosUser)
def editFlightUser(): oldIDFlight = request.form.get('oldIDFlight') oldIDUser = request.form.get('oldIDUser') idFlight = request.form.get('idFlight') idUser = request.form.get('idUser') seatNumber = request.form.get('seatNumber') flight = Flight.SelectFlightsID(idFlight) user = User.SelectUserID(idUser) seat = Seats.SelectSeatsID(seatNumber) flightUser = FlightUser.SelectFlightUserID(oldIDFlight, oldIDUser) flightUser.UpdateFlightUser(flight, user, seat) return redirect('/flightUser')
def GetFlightUser(dic): flight = Flight.SelectFlightsID(dic["idFlight"]) user = User.SelectUserID(dic["idUser"]) seat = Seats.SelectSeatsID(dic["seatNumber"]) return flight, user, seat