예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
 public void Save()
 {
     _db.SaveChanges();
 }