public int DeletePassengerById(int Id) { TicketBookingModelEntities db = new TicketBookingModelEntities(); Passenger p = new Passenger(); p.Id = Id; db.Entry(p).State = EntityState.Deleted; int Retval = db.SaveChanges(); return(Retval); }
public int DeleteDriverById(int DriverId) { TicketBookingModelEntities db = new TicketBookingModelEntities(); Driver drv = new Driver(); drv.DriverId = DriverId; db.Entry(drv).State = EntityState.Deleted; int Retval = db.SaveChanges(); return(Retval); }
public int AddPassenger(string Name, bool Blocked) { TicketBookingModelEntities db = new TicketBookingModelEntities(); Passenger p = new Passenger(); p.Name = Name; p.Blocked = Blocked; db.Passengers.Add(p); int Retval = db.SaveChanges(); return(Retval); }
public int UpdatePassenger(int Id, string Name, bool Blocked) { TicketBookingModelEntities db = new TicketBookingModelEntities(); Passenger p = new Passenger(); p.Id = Id; p.Name = Name; p.Blocked = Blocked; db.Entry(p).State = EntityState.Modified; int Retval = db.SaveChanges(); return(Retval); }
public Passenger GetPassengerById(int Id) { TicketBookingModelEntities db = new TicketBookingModelEntities(); var lstD = from k in db.Passengers where k.Id == Id select k; Passenger p = new Passenger(); foreach (var item in lstD) { p.Id = item.Id; p.Name = item.Name; p.Blocked = item.Blocked; } return(p); }
public int AddDriver(string Name, string SerialNumber, string DriverLicence, string PhoneNumber, string EmailAddress, bool IsAvailable) { TicketBookingModelEntities db = new TicketBookingModelEntities(); Driver drv = new Driver(); drv.Name = Name; drv.SerialNumber = SerialNumber; drv.DriverLicence = DriverLicence; drv.PhoneNumber = PhoneNumber; drv.EmailAddress = EmailAddress; drv.IsAvailable = IsAvailable; db.Drivers.Add(drv); int Retval = db.SaveChanges(); return(Retval); }
public List <Passenger> GetAllPassengers() { List <Passenger> Plst = new List <Passenger>(); TicketBookingModelEntities db = new TicketBookingModelEntities(); var lstD = from k in db.Passengers select k; foreach (var item in lstD) { Passenger p = new Passenger(); p.Id = item.Id; p.Name = item.Name; p.Blocked = item.Blocked; Plst.Add(p); } return(Plst); }
public int UpdateDriver(int DriverId, string Name, string SerialNumber, string DriverLicence, string PhoneNumber, string EmailAddress, bool IsAvailable) { TicketBookingModelEntities db = new TicketBookingModelEntities(); Driver drv = new Driver(); drv.DriverId = DriverId; drv.Name = Name; drv.SerialNumber = SerialNumber; drv.DriverLicence = DriverLicence; drv.PhoneNumber = PhoneNumber; drv.EmailAddress = EmailAddress; drv.IsAvailable = IsAvailable; db.Entry(drv).State = EntityState.Modified; int Retval = db.SaveChanges(); return(Retval); }
public Driver GetDriverById(int DriverId) { TicketBookingModelEntities db = new TicketBookingModelEntities(); var lstD = from k in db.Drivers where k.DriverId == DriverId select k; Driver drv = new Driver(); foreach (var item in lstD) { drv.DriverId = item.DriverId; drv.Name = item.Name; drv.SerialNumber = item.SerialNumber; drv.DriverLicence = item.DriverLicence; drv.PhoneNumber = item.PhoneNumber; drv.EmailAddress = item.EmailAddress; drv.IsAvailable = item.IsAvailable; } return(drv); }
public List <Driver> GetAllDrivers() { List <Driver> drvlst = new List <Driver>(); TicketBookingModelEntities db = new TicketBookingModelEntities(); var lstD = from k in db.Drivers select k; foreach (var item in lstD) { Driver drv = new Driver(); drv.DriverId = item.DriverId; drv.Name = item.Name; drv.SerialNumber = item.SerialNumber; drv.DriverLicence = item.DriverLicence; drv.PhoneNumber = item.PhoneNumber; drv.EmailAddress = item.EmailAddress; drv.IsAvailable = item.IsAvailable; drvlst.Add(drv); } return(drvlst); }
public SeatsRepository(TicketBookingModelEntities db) { this._db = db; }
public PassengersRepository(TicketBookingModelEntities db) { this._db = db; }
public FeedbackRepository(TicketBookingModelEntities db) { this._db = db; }
public ReservationsRepository(TicketBookingModelEntities db) { this._db = db; }