public IEnumerable <Kapetan> GetAllCaptains() { using (var db = new CruiseTrackerDBEntities()) { return(db.Kapetans.Include(k => k.Plovidbas).Include(k => k.Brods).ToList()); } }
public IEnumerable <Luka> GetAllHarbors() { using (var db = new CruiseTrackerDBEntities()) { return(db.Lukas.Include(l => l.Plovidbas).Include(l => l.Destinacija_Koristi_Luku).ToList()); } }
public IEnumerable <Destinacija> GetAllDestinations() { using (var db = new CruiseTrackerDBEntities()) { return(db.Destinacijas.Include(d => d.Plovidbas).ToList()); } }
public IEnumerable <Teretni> GetAllCargoShips() { using (var db = new CruiseTrackerDBEntities()) { return(db.Teretnis.Include(t => t.Firmas).Include(t => t.Brod).ToList()); } }
public Brod GetBoat(int boatId) { using (var db = new CruiseTrackerDBEntities()) { return(db.Brods.Where(b => b.idBroda == boatId).FirstOrDefault()); } }
public Destinacija GetDestination(int destinationId) { using (var db = new CruiseTrackerDBEntities()) { return(db.Destinacijas.Where(d => d.brDestinacije == destinationId).Include(d => d.Plovidbas).FirstOrDefault()); } }
public Putnicki GetPassengerShip(int passengerShipId) { using (var db = new CruiseTrackerDBEntities()) { return(db.Putnickis.Where(p => p.idBroda == passengerShipId).Include(p => p.Brod).FirstOrDefault()); } }
public IEnumerable <Putnicki> GetAllPassengerShips() { using (var db = new CruiseTrackerDBEntities()) { return(db.Putnickis.Include(p => p.Brod).ToList()); } }
public Teretni GetCargoShip(int cargoShipId) { using (var db = new CruiseTrackerDBEntities()) { return(db.Teretnis.Where(t => t.idBroda == cargoShipId).Include(t => t.Brod).Include(t => t.Firmas).FirstOrDefault()); } }
public IEnumerable <Brod> GetAllBoats() { using (var db = new CruiseTrackerDBEntities()) { return(db.Brods.ToList()); } }
public void UpdateCruise(Plovidba cruise) { using (var db = new CruiseTrackerDBEntities()) { db.Plovidbas.AddOrUpdate(cruise); db.SaveChanges(); } }
public void RemoveCruise(int cruiseId) { using (var db = new CruiseTrackerDBEntities()) { db.Plovidbas.Remove(db.Plovidbas.Where(p => p.brPlovidbe == cruiseId).FirstOrDefault()); db.SaveChanges(); } }
public IEnumerable <Plovidba> GetAllCruises() { using (var db = new CruiseTrackerDBEntities()) { return(db.Plovidbas.Include(p => p.Destinacija).Include(p => p.Luka).Include(p => p.Kapetan) .Include(p => p.Kartas).ToList()); } }
public void UpdateHarbor(Luka harbor) { using (var db = new CruiseTrackerDBEntities()) { db.Lukas.AddOrUpdate(harbor); db.SaveChanges(); } }
public void RemoveCaptain(int captainId) { using (var db = new CruiseTrackerDBEntities()) { db.Kapetans.Remove(GetCaptain(captainId)); db.SaveChanges(); } }
public Luka GetHarbor(int harborId) { using (var db = new CruiseTrackerDBEntities()) { return(db.Lukas.Where(l => l.idLuke == harborId).Include(l => l.Plovidbas) .Include(l => l.Destinacija_Koristi_Luku).FirstOrDefault()); } }
public void UpdateCargoShip(Teretni cargoShip) { using (var db = new CruiseTrackerDBEntities()) { db.Teretnis.AddOrUpdate(cargoShip); db.SaveChanges(); } }
public void UpdatePassengerShip(Putnicki passengerShip) { using (var db = new CruiseTrackerDBEntities()) { db.Putnickis.AddOrUpdate(passengerShip); db.SaveChanges(); } }
public void UpdateCaptain(Kapetan captain) { using (var db = new CruiseTrackerDBEntities()) { db.Kapetans.AddOrUpdate(captain); db.SaveChanges(); } }
public Plovidba GetCruise(int cruiseId) { using (var db = new CruiseTrackerDBEntities()) { return(db.Plovidbas.Where(p => p.brDestinacije == cruiseId).Include(p => p.Destinacija).Include(p => p.Luka).Include(p => p.Kapetan) .Include(p => p.Kartas).FirstOrDefault()); } }
public Kapetan GetCaptain(int captainId) { using (var db = new CruiseTrackerDBEntities()) { return(db.Kapetans.Where(c => c.idKapetana == captainId).Include(k => k.Plovidbas).Include(k => k.Brods) .FirstOrDefault()); } }
public void UpdateBoat(Brod boat) { using (var db = new CruiseTrackerDBEntities()) { db.Brods.AddOrUpdate(boat); db.SaveChanges(); } }
public void UpdateDestination(Destinacija destination) { using (var db = new CruiseTrackerDBEntities()) { db.Destinacijas.AddOrUpdate(destination); db.SaveChanges(); } }
public void RemoveBoat(int Boat) { using (var db = new CruiseTrackerDBEntities()) { db.Brods.Remove(db.Brods.Where(b => b.idBroda == Boat).FirstOrDefault()); db.SaveChanges(); } }
public void RemovePassengerShip(int passengerShipId) { using (var db = new CruiseTrackerDBEntities()) { db.Putnickis.Remove(db.Putnickis.Where(p => p.idBroda == passengerShipId).Include(p => p.Brod) .FirstOrDefault()); db.SaveChanges(); } }
public void RemoveHarbor(int harborId) { using (var db = new CruiseTrackerDBEntities()) { db.Lukas.Remove(db.Lukas.Where(l => l.idLuke == harborId).Include(l => l.Plovidbas) .Include(l => l.Destinacija_Koristi_Luku).FirstOrDefault()); db.SaveChanges(); } }
public void RemoveDestination(int destinationID) { using (var db = new CruiseTrackerDBEntities()) { db.Destinacijas.Remove(db.Destinacijas.Where(d => d.brDestinacije == destinationID) .Include(d => d.Plovidbas).FirstOrDefault()); db.SaveChanges(); } }
public void RemoveCargoShip(int id) { using (var db = new CruiseTrackerDBEntities()) { db.Teretnis.Remove(db.Teretnis.Where(t => t.idBroda == id).Include(t => t.Firmas) .FirstOrDefault()); db.SaveChanges(); } }
public int GetCruisesCountForDestIdAndCapName(string destId, string capName) { int rVal = 0; using (var db = new CruiseTrackerDBEntities()) { try { rVal = db.Database .SqlQuery <Int32>($"EXECUTE [dbo].[BrojPlovidbiZaIstuDestinacijuIKapetana] {destId},{capName}") .FirstOrDefault(); return(rVal); } catch (Exception e) { Trace.WriteLine(e.Message); return(rVal); } } }
public int GetCruisesCountForDestNameAndCapName(string destName, string capName) { int rVal = 0; using (var db = new CruiseTrackerDBEntities()) { try { rVal = db.Database .SqlQuery <Int32>($"SELECT * FROM [dbo].[GetCruisesCountForDestinationAndCaptain]('{destName}','{capName}')") .FirstOrDefault(); return(rVal); } catch (Exception e) { Trace.WriteLine(e.Message); return(rVal); } } }