Example #1
0
        public void AddUser(DetailsOfUser detailsOfUser)
        {
            DataBaseEntities1 db = new DataBaseEntities1();

            db.Users.Add(detailsOfUser.ConvertUserToDal());
            db.SaveChanges();
        }
        public void AddCustomer(DetailsOfCustomer detailsOfCustomer)
        {
            DataBaseEntities1 db = new DataBaseEntities1();

            db.Customers.Add(detailsOfCustomer.ConvertCustomerToDal());
            db.SaveChanges();
        }
Example #3
0
        public void AddVehicle(DetialsOfVehicles detialsOfVehicles)
        {
            DataBaseEntities1 db = new DataBaseEntities1();

            db.Details_of_vehicles.Add(detialsOfVehicles.ConvertVehiclesIoDal());
            db.SaveChanges();
        }
        public void AddTrack(DetailsOfTrack detailsOfTrack)
        {
            DataBaseEntities1 db = new DataBaseEntities1();

            db.Track_to_travel.Add(detailsOfTrack.ConvertTrackToDal());
            db.SaveChanges();
        }
        public void AddTravel(DetailsOfTravel detailsOfTravel)
        {
            DataBaseEntities1 db = new DataBaseEntities1();

            db.Travels.Add(detailsOfTravel.ConvertTravelToDal());
            db.SaveChanges();
        }
        public void AddPassenger(DetailsOfPassenger detailsOfPassenger)
        {
            DataBaseEntities1 db = new DataBaseEntities1();

            db.Passengers.Add(detailsOfPassenger.ConvertPassengerToDal());
            db.SaveChanges();
        }
        public void UpdateTrack(DetailsOfTrack detailsOfTrack)
        {
            Track_to_travel tracks = Mapper.ConvertTrackToDal(detailsOfTrack);

            using (var db = new DataBaseEntities1())
            {
                db.Entry <Track_to_travel>(db.Set <Track_to_travel>().Find(tracks.Track_s_code)).CurrentValues.SetValues(tracks);
                db.SaveChanges();
            }
        }
Example #8
0
        public void UpdateVehicle(DetialsOfVehicles detialsOfVehicles)
        {
            Details_of_vehicles details_Of_Vehicles = Mapper.ConvertVehiclesIoDal(detialsOfVehicles);

            using (var db = new DataBaseEntities1())
            {
                db.Entry <Details_of_vehicles>(db.Set <Details_of_vehicles>().Find(details_Of_Vehicles.License_plate)).CurrentValues.SetValues(details_Of_Vehicles);
                db.SaveChanges();
            }
        }
Example #9
0
        public void UpdateUser(DetailsOfUser detailsOfUser)
        {
            Users users = Mapper.ConvertUserToDal(detailsOfUser);

            using (var db = new DataBaseEntities1())
            {
                db.Entry <Users>(db.Set <Users>().Find(users.User_s_Id)).CurrentValues.SetValues(users);
                db.SaveChanges();
            }
        }
        public void UpdateTravel(DetailsOfTravel detailsOfTravel)
        {
            Travels travels = Mapper.ConvertTravelToDal(detailsOfTravel);

            using (var db = new DataBaseEntities1())
            {
                db.Entry <Travels>(db.Set <Travels>().Find(travels.Travel_s_code)).CurrentValues.SetValues(travels);
                db.SaveChanges();
            }
        }
        public void UpdatePassenger(DetailsOfPassenger detailsOfPassenger)
        {
            Passengers passengers = Mapper.ConvertPassengerToDal(detailsOfPassenger);

            using (var db = new DataBaseEntities1())
            {
                db.Entry <Passengers>(db.Set <Passengers>().Find(passengers.Passenger_s_code)).CurrentValues.SetValues(passengers);
                db.SaveChanges();
            }
        }
        public void UpdateCustomer(DetailsOfCustomer detailsOfCustomer)
        {
            Customers customers = Mapper.ConvertCustomerToDal(detailsOfCustomer);

            using (var db = new DataBaseEntities1())
            {
                db.Entry <Customers>(db.Set <Customers>().Find(customers.Group_s_code)).CurrentValues.SetValues(customers);
                db.SaveChanges();
            }
        }
 public void RemoveTrack(string id)
 {
     using (var db = new DataBaseEntities1())
     {
         Track_to_travel t = db.Track_to_travel.Find(id);
         if (t != null)
         {
             db.Track_to_travel.Remove(t);
             db.SaveChanges();
         }
     }
 }
Example #14
0
 public void RemoveUser(int id)
 {
     using (var db = new DataBaseEntities1())
     {
         Users users = db.Users.Find(id);
         if (users != null)
         {
             db.Users.Remove(users);
             db.SaveChanges();
         }
     }
 }
 public void RemovePassenger(string id)
 {
     using (var db = new DataBaseEntities1())
     {
         Passengers p = db.Passengers.Find(id);
         if (p != null)
         {
             db.Passengers.Remove(p);
             db.SaveChanges();
         }
     }
 }
Example #16
0
        public void RemoveVehicle(int id)
        {
            string i = id.ToString();

            using (var db = new DataBaseEntities1())
            {
                Details_of_vehicles c = db.Details_of_vehicles.Find(i);
                if (c != null)
                {
                    db.Details_of_vehicles.Remove(c);
                    db.SaveChanges();
                }
            }
        }
 public void RemoveCustomer(string id)
 {
     using (var db = new DataBaseEntities1())
     {
         // db.Entry(db.Customers.Find(id)).State = System.Data.Entity.EntityState.Deleted;
         Customers c = db.Customers.Find(id);
         if (c != null)
         {
             db.Customers.Remove(c);
             db.SaveChanges();
         }
         //db.SaveChanges();
     }
 }