Пример #1
0
        private CountryDto ConvertLaunchLibraryCountryModelToDto(LibraryLaunchModel launch)
        {
            var countryDto = new CountryDto
            {
                CountryCode = launch.Location.CountryCode
            };

            return(countryDto);
        }
Пример #2
0
        private AgencyDto ConvertLaunchLibraryAgencyModelToDto(LibraryLaunchModel launch, CountryDto country)
        {
            var agencyDto = new AgencyDto
            {
                AgencyName = launch.Location?.Pads?.FirstOrDefault()?.Agencies?.FirstOrDefault()?.AgencyName,
                InfoUrl    = launch.Location.Pads.FirstOrDefault().WikiURL,
                Country    = country
            };

            return(agencyDto);
        }
Пример #3
0
        private LaunchDto ConvertLaunchLibraryLaunchModelToDto(LibraryLaunchModel launch, CountryDto country, AgencyDto agency)
        {
            var launchDto = new LaunchDto
            {
                LaunchNumber   = launch.LaunchId,
                MissionName    = launch.LaunchName,
                LaunchDate     = DateTime.ParseExact(launch.LaunchTime, "MMMM d, yyyy HH:mm:ss UTC", CultureInfo.InvariantCulture),
                LaunchSite     = launch.Location.LocationName,
                RocketName     = launch.Rocket.RocketName,
                MissionDetails = launch.Missions?.FirstOrDefault()?.MissionDescription,
                InfoUrl        = launch.Location?.Pads?.FirstOrDefault()?.InfoUrl,
                ChangedTime    = DateTime.Now,
                UpdatedTime    = DateTime.UtcNow,
                Country        = country,
                Agency         = agency
            };

            return(launchDto);
        }