Esempio n. 1
0
        public async Task <IActionResult> Index()
        {
            var planets = await _service.GetAllPlanets();

            return(View(new PlanetIndexViewModel
            {
                Planets = planets
            }));
        }
Esempio n. 2
0
        public async Task <IEnumerable <PlanetViewModel> > GetAllPlanets()
        {
            var planetsWithAppearance = new List <PlanetViewModel>();
            var result = await _service.GetAllPlanets();

            var resultMapped = _mapper.Map <List <PlanetViewModel> >(result);

            foreach (var item in resultMapped)
            {
                var newPlanetWithAppearance = await GetAppearanceInMovies(item);

                planetsWithAppearance.Add(newPlanetWithAppearance);
            }

            return(planetsWithAppearance);
        }
Esempio n. 3
0
        public void Get_GetAll_SetupedResult()
        {
            var result = _planetService.GetAllPlanets();

            result.Should().BeEquivalentTo(_planets);
        }