Example #1
0
 public static IJourney MapFromDto(Dto.Journey dto)
 {
     return(new Journey
     {
         Id = dto.Id,
         Distance = dto.Distance,
         StartLocation = (Location)LocationRepo.MapFromDto(dto.StartLocation),
         EndLocation = (Location)LocationRepo.MapFromDto(dto.EndLocation)
     });
 }
Example #2
0
 private IJourneyLog MapFromDto(Dto.JourneyLog dto)
 {
     return(new JourneyLog
     {
         Id = dto.Id,
         JourneyId = dto.Journey.Id,
         Date = dto.Date.ToString("dd-MM-yyyy"),
         StartLocation = LocationRepo.MapFromDto(dto.Journey.StartLocation),
         EndLocation = LocationRepo.MapFromDto(dto.Journey.EndLocation),
         Distance = dto.Journey.Distance
     });
 }
Example #3
0
        public Dto.Journey MapToDto(IJourney journey)
        {
            using (MilesDb db = new MilesDb())
            {
                var dto = new Dto.Journey
                {
                    Id            = journey.Id,
                    Distance      = journey.Distance,
                    StartLocation = LocationRepo.MapToDto(journey.StartLocation),
                    EndLocation   = LocationRepo.MapToDto(journey.EndLocation)
                };

                return(dto);
            }
        }