예제 #1
0
        /// <summary>
        /// Retrieve detailed information about a single planet identified by planetid.
        /// </summary>
        /// <param name="planetid">The id of the planet to be retrieved.</param>
        /// <returns>ActionResult</returns>
        public async Task <IActionResult> GetPlanetTwentyTwo(int planetid)
        {
            var planet = await _StarWarsService.GetPlanetAsync(planetid);

            var model = new SinglePlanetViewModel
            {
                Climate                = planet.Climate,
                Diameter               = planet.Diameter,
                Gravity                = planet.Gravity,
                LengthOfDay            = planet.LengthOfDay,
                LengthOfYear           = planet.LengthOfYear,
                Name                   = planet.Name,
                Population             = planet.Population,
                SurfaceWaterPercentage = planet.SurfaceWaterPercentage
            };

            return(View(model));
        }