public void Delete(BUSES obj) { try { using (db = new PasajesBDEntities()) { db.Entry(obj).State = EntityState.Deleted; db.SaveChanges(); } } catch (Exception) { throw; } }
public void Add(BUSES obj) { try { using (db = new PasajesBDEntities()) { db.BUSES.Add(obj); db.SaveChanges(); } } catch (Exception) { throw; } }
public IEnumerable <BUSES> GetAll() { try { using (db = new PasajesBDEntities()) { return((from t in db.BUSES select t).ToList()); } } catch (Exception) { throw; } }
public void Update(RUTAS obj) { try { using (db = new PasajesBDEntities()) { db.Entry(obj).State = EntityState.Modified; db.SaveChanges(); } } catch (Exception) { throw; } }
public static IEnumerable <CIUDADES> GetAllId(this RutasBLL r, WInteger id) { try { using (db = new PasajesBDEntities()) { return((from t in db.CIUDADES where !t.IdCiudad.Equals(id.Value) select t).ToList()); } } catch (Exception) { throw; } }
public BUSES GetById(string id) { try { using (db = new PasajesBDEntities()) { return((from t in db.BUSES where t.IdBus.Equals(id) select t).SingleOrDefault()); } } catch (Exception) { throw; } }
public RUTAS GetById(WInteger id) { try { using (db = new PasajesBDEntities()) { return((from t in db.RUTAS where t.IdRuta.Equals(id.Value) select t).SingleOrDefault()); } } catch (Exception) { throw; } }
public CIUDADES GetById(WInteger id) { try { using (db = new PasajesBDEntities()) { return((from t in db.CIUDADES where t.IdCiudad.Equals(id.Value) select t).SingleOrDefault()); //return db.CIUDADES.Where(x => x.IdCiudad.Equals(id)).SingleOrDefault(); } } catch (Exception) { throw; } }
public IEnumerable <object> GetAll2() { try { using (db = new PasajesBDEntities()) { return((from t in db.RUTAS join ciu in db.CIUDADES on t.CiudadOrigen equals ciu.IdCiudad join ciu2 in db.CIUDADES on t.CiudadDestino equals ciu2.IdCiudad select new { idruta = t.IdRuta, ciudadOrigen = ciu.NombreCiudad, ciudadDestino = ciu2.NombreCiudad, valor = t.Valor }).ToList()); } } catch (Exception) { throw; } }