Ejemplo n.º 1
0
        public static Passengers ConvertPassengerToDal(this common.DetailsOfPassenger detailsOfPassenger)
        {
            Passengers detailsOfPassengerDal = new Passengers();

            detailsOfPassengerDal.Passenger_s_code    = detailsOfPassenger.PassengerCode;
            detailsOfPassengerDal.Passenger_s_name    = detailsOfPassenger.PassengerName;
            detailsOfPassengerDal.Passenger_s_address = detailsOfPassenger.PassengerAddress;
            return(detailsOfPassengerDal);
        }
        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 RemovePassenger(string id)
 {
     using (var db = new DataBaseEntities1())
     {
         Passengers p = db.Passengers.Find(id);
         if (p != null)
         {
             db.Passengers.Remove(p);
             db.SaveChanges();
         }
     }
 }
Ejemplo n.º 4
0
 public static DetailsOfPassenger ConvertPassengerToCommon(Passengers passengers)
 {
     return(new DetailsOfPassenger(passengers.Passenger_s_code, passengers.Passenger_s_name, passengers.Passenger_s_address));
 }