public void assignCargoToRoute(string trackingIdStr, RouteCandidateDTO routeCandidateDTO)
        {
            var itinerary = DTOAssembler.fromDTO(routeCandidateDTO, voyageRepository, locationRepository);
            var trackingId = new TrackingId(trackingIdStr);

            bookingService.assignCargoToRoute(itinerary, trackingId);
        }
예제 #2
0
        public ActionResult AssignItinerary(RouteAssignmentCommand command)
        {
            var legs = command.legs
                .Select(leg => new LegDTO(
                    leg.voyageNumber, 
                    leg.fromUnLocode, 
                    leg.toUnLocode, 
                    leg.fromDate, 
                    leg.toDate));

            var selectedRoute = new RouteCandidateDTO(legs);
            _bookingServiceFacade.assignCargoToRoute(command.trackingId, selectedRoute);

            return RedirectToAction("Show", new { command.trackingId });
        }
예제 #3
0
 internal static Itinerary fromDTO(RouteCandidateDTO routeCandidateDTO,
                          VoyageRepository voyageRepository,
                          LocationRepository locationRepository)
 {
     var legs = new List<Leg>(routeCandidateDTO.getLegs().Count());
     foreach(LegDTO legDTO in routeCandidateDTO.getLegs())
     {
         var voyageNumber = new VoyageNumber(legDTO.getVoyageNumber());
         var voyage = voyageRepository.find(voyageNumber);
         var from = locationRepository.find(new UnLocode(legDTO.getFrom()));
         var to = locationRepository.find(new UnLocode(legDTO.getTo()));
         legs.Add(Leg.DeriveLeg(voyage, from, to));
     }
     return new Itinerary(legs);
 }