/// <summary> /// Actualizar un Reservacion /// </summary> /// <param name="data"></param> /// <returns></returns> public bool UpdateReservation(ReservationData data) { using (tecAirlinesEntities entities = new tecAirlinesEntities()) { try { var user = entities.Reservas.Find(data.Codigo); //user.Nombre = data.Nombre; //user.Apellido1 = data.Apellido1; //user.Apellido2 = data.Apellido2; user.Chequeo = data.Chequeo; user.Equipaje = data.Equipaje; //user.Carne = data.Carne; //user.Correo = data.Correo; //user.Universidad = data.Universidad; //user.Contraseña = data.Contraseña; entities.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
/// <summary> /// Elimina un promocion /// </summary> /// <param name="id"></param> /// <returns></returns> public bool DeletePromotion(string id) { using (tecAirlinesEntities entities = new tecAirlinesEntities()) { try { var ms = entities.Promocions.Find(id); entities.Promocions.Remove(ms); entities.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
/// <summary> /// Elimina un usuario /// </summary> /// <param name="correo"></param> /// <returns></returns> public bool DeleteUser(string correo) { using (tecAirlinesEntities entities = new tecAirlinesEntities()) { try { var ms = entities.Usuarios.Find(correo); entities.Usuarios.Remove(ms); entities.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
/// <summary> /// Elimina un avion /// </summary> /// <param name="id"></param> /// <returns></returns> public bool DeleteAirship(int id) { using (tecAirlinesEntities entities = new tecAirlinesEntities()) { try { var ms = entities.Aeronaves.Find(id); entities.Aeronaves.Remove(ms); entities.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
/// <summary> /// Actualizar un avion /// </summary> /// <param name="data"></param> /// <returns></returns> public bool UpdateAirship(AirshipData data) { using (tecAirlinesEntities entities = new tecAirlinesEntities()) { try { var airship = entities.Aeronaves.Find(data.Identificador); airship.Identificador = data.Identificador; airship.Modelo = data.Modelo; airship.Capacidad = data.Capacidad; entities.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
/// <summary> /// Agrega un nuevo tiquete /// </summary> /// <param name="data"></param> /// <returns></returns> public bool AddTicket(TicketData data) { using (tecAirlinesEntities entities = new tecAirlinesEntities()) { Tiquete newTicket = new Tiquete(); newTicket.C_Reserva = data.C_Reserva; newTicket.N_Asiento = data.N_Asiento; try { entities.Tiquetes.Add(newTicket); entities.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
/// <summary> /// Agrega un nuevo avion /// </summary> /// <param name="data"></param> /// <returns></returns> public bool AddAirship(AirshipData data) { using (tecAirlinesEntities entities = new tecAirlinesEntities()) { Aeronave newAirship = new Aeronave(); newAirship.Identificador = data.Identificador; newAirship.Modelo = data.Modelo; newAirship.Capacidad = data.Capacidad; try { entities.Aeronaves.Add(newAirship); entities.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
/// <summary> /// Agrega un nuevo Programa /// </summary> /// <param name="data"></param> /// <returns></returns> public bool AddProgram(ProgramData data) { using (tecAirlinesEntities entities = new tecAirlinesEntities()) { Programa newProgram = new Programa(); newProgram.C_Usuario = data.C_Usuario; newProgram.ID_Universidad = data.ID_Universidad; newProgram.Millas = data.Millas; try { entities.Programas.Add(newProgram); entities.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
/// <summary> /// Agrega un nuevo reservacion /// </summary> /// <param name="data"></param> /// <returns></returns> public bool AddReservation(ReservationData data) { using (tecAirlinesEntities entities = new tecAirlinesEntities()) { Reserva newReservation = new Reserva(); newReservation.Codigo = data.Codigo; newReservation.Chequeo = data.Chequeo; newReservation.Equipaje = data.Equipaje; newReservation.C_Vuelo = data.C_Vuelo; try { entities.Reservas.Add(newReservation); entities.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
/// <summary> /// Agrega un nueva promocion /// </summary> /// <param name="data"></param> /// <returns></returns> public bool AddPromotion(PromotionData data) { using (tecAirlinesEntities entities = new tecAirlinesEntities()) { Promocion newPromotion = new Promocion(); newPromotion.C_Usuario = data.C_Usuario; newPromotion.C_Vuelo = data.C_Vuelo; newPromotion.F_Inicio = data.F_Inicio; newPromotion.F_Fin = data.F_Fin; newPromotion.Porcentaje = data.Porcentaje; newPromotion.Imagen = data.Imagen; try { entities.Promocions.Add(newPromotion); entities.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
/// <summary> /// Actualizar un usuario /// </summary> /// <param name="data"></param> /// <returns></returns> public bool UpdateUser(UserData data) { using (tecAirlinesEntities entities = new tecAirlinesEntities()) { try { var user = entities.Usuarios.Find(data.Correo); user.Nombre = data.Nombre; user.Apellido1 = data.Apellido1; user.Apellido2 = data.Apellido2; user.Telefono = data.Telefono; user.Carne = data.Carne; user.Correo = data.Correo; user.Universidad = data.Universidad; user.Contraseña = data.Contraseña; entities.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }