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(); } }
public static Track_to_travel ConvertTrackToDal(this common.DetailsOfTrack detailsOfTrack) { Track_to_travel detailsOfTrackDal = new Track_to_travel(); detailsOfTrackDal.Track_s_code = detailsOfTrack.TrackCode; detailsOfTrackDal.Travel_s_code = detailsOfTrack.TravelCode; detailsOfTrackDal.Driver_s_Id = detailsOfTrack.DriverId; detailsOfTrackDal.License_plate = detailsOfTrack.LicensePlate; detailsOfTrackDal.Date_of_travel = detailsOfTrack.DateOfTravel; detailsOfTrackDal.Hour_of_begin = detailsOfTrack.HourOfBegin; return(detailsOfTrackDal); }
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(); } } }
public static DetailsOfTrack ConvertTrackToCommon(Track_to_travel track) { return(new DetailsOfTrack(track.Track_s_code, track.Travel_s_code, track.Driver_s_Id, track.License_plate, track.Date_of_travel, track.Hour_of_begin)); }