private JourneyTemplate Gather(string journeyTemplateName) { return(new JourneyTemplate { Name = journeyTemplateName, RouteDistance = RouteDistance, Lifts = Lifts.Select(lift => new LiftTemplate { LiftDistance = lift.LiftDistance, PassengerName = lift.PassengerName }).ToList() }); }
private void AddJourney() { var journeyId = _idFactory.Create(); try { var lifts = Lifts.Select(lift => lift.ToDto()); _commandDispatcher.Dispatch(new AddJourneyWithLiftsCommand(journeyId, RouteDistance, DateOfOccurrence, lifts)); _eventBus.Publish(new JourneyWithLiftsAddedEvent(journeyId)); Notification.Replace(new SuccessNotification("Added successfuly.")); } catch (Exception e) { Notification.Replace(new ErrorNotification(e.Message)); } }