Пример #1
0
        /// <summary>
        /// Convert from a <see cref="IJourneyViewModel"/> to a <see cref="IJourneyDetailsType"/>.
        /// </summary>
        /// <param name="input"><see cref="IJourneyViewModel"/> to convert</param>
        /// <returns>converted <see cref="IJourneyDetailsType"/></returns>
        public static IJourneyDetailsType ToJourneyModel(IJourneyViewModel input)
        {
            List <string> units = new List <string>();

            JourneyFactory.Add(units, input.UnitOne);
            JourneyFactory.Add(units, input.UnitTwo);
            JourneyFactory.Add(units, input.UnitThree);
            JourneyFactory.Add(units, input.UnitFour);

            IJourneyDetailsType model =
                new JourneyDetailsType(
                    input.JnyId.Date,
                    input.JnyId.JnyNumber,
                    input.From,
                    input.To,
                    input.Route,
                    input.Distance,
                    units);

            return(model);
        }