コード例 #1
0
        public async Task <PlanetDetailsViewModel> GetPlanetDetails(string url)
        {
            var apiPlanet = await _planetService.GetPlanetFromUrl(url);

            var planetDetails = new PlanetDetailsViewModel();

            planetDetails.name            = apiPlanet.name;
            planetDetails.climate         = apiPlanet.climate;
            planetDetails.diameter        = apiPlanet.diameter;
            planetDetails.films           = apiPlanet.films;
            planetDetails.gravity         = apiPlanet.gravity;
            planetDetails.orbital_period  = apiPlanet.orbital_period;
            planetDetails.population      = apiPlanet.population;
            planetDetails.residents       = apiPlanet.residents;
            planetDetails.rotation_period = apiPlanet.rotation_period;
            planetDetails.surface_water   = apiPlanet.surface_water;
            planetDetails.terrain         = apiPlanet.terrain;

            return(planetDetails);
        }