public static DTO.DriveDTO convertToDriveDTO(DAL.Drive drive) { if (drive == null) { return(null); } Loction fromL = LocationDAL.GetLocationById(drive.fromLocation); Loction toL = LocationDAL.GetLocationById(drive.toLocation); DTO.DriveDTO newdrive = new DTO.DriveDTO() { //driveCode = drive.driveCode, driverCode = drive.driverCode, customerCode = drive.customerCode, drivingTime = drive.drivingTime, travelDate = drive.travelDate, fromLocationFormat = fromL.locationFormat, fromLocationLat = fromL.locationLat, fromLocationLng = fromL.locationLng, toLocationFormat = toL.locationFormat, toLocationLat = toL.locationLat, toLocationLng = toL.locationLng, //fromLocation = drive.fromLocation, //toLocation = drive.toLocation, packageSizeCode = drive.packageSizeCode, howLongBeforeReminder = drive.howLongBeforeReminder, transportation = drive.transportation, describeDrive = drive.describeDrive, confirmationCustomer = drive.confirmationCustomer }; return(newdrive); }
public static string AddDrive(DTO.DriveDTO drive) { Loction fromL = new Loction() { locationFormat = drive.fromLocationFormat, locationLat = drive.fromLocationLat, locationLng = drive.fromLocationLng }; Loction FrLo = LocationDAL.AddLocation(fromL); Loction toL = new Loction() { locationFormat = drive.toLocationFormat, locationLat = drive.toLocationLat, locationLng = drive.toLocationLng }; Loction ToLo = LocationDAL.AddLocation(toL); Drive d = DriveConverter.convertDtoToDALDrive(drive); d.fromLocation = FrLo.locationId; d.toLocation = ToLo.locationId; return(DAL.DriveDAL.AddDrive(d)); }