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 RemoveTravel(string id)
 {
     using (var db = new DataBaseEntities1())
     {
         Travels t = db.Travels.Find(id);
         if (t != null)
         {
             db.Travels.Remove(t);
             db.SaveChanges();
         }
     }
 }
        public static Travels ConvertTravelToDal(this common.DetailsOfTravel detailsOfTravel)
        {
            Travels detailsOfTravelDal = new Travels();

            detailsOfTravelDal.Travel_s_code            = detailsOfTravel.TravelCode;
            detailsOfTravelDal.Collection_or_dispersing = detailsOfTravel.CollectionOrDispersing;
            detailsOfTravelDal.Destination_or_source    = detailsOfTravel.DestinationOrSource;
            detailsOfTravelDal.Hour          = detailsOfTravel.Hour;
            detailsOfTravelDal.Frequency     = detailsOfTravel.Frequency;
            detailsOfTravelDal.Date_of_begin = detailsOfTravel.DateOfBegin;
            detailsOfTravelDal.Date_of_end   = detailsOfTravel.DateOfEnd;
            return(detailsOfTravelDal);
        }
 public static DetailsOfTravel ConvertTravelToCommon(Travels travels)
 {
     return(new DetailsOfTravel(travels.Travel_s_code, travels.Collection_or_dispersing, travels.Destination_or_source, travels.Hour, travels.Frequency, travels.Date_of_begin, travels.Date_of_end));
 }