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 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 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 void Save() { _db.SaveChanges(); }