예제 #1
0
        public Planet Create(PlanetInputDto planetInput)
        {
            Planet newPlanet = _planetRepository.Create(new Planet(planetInput.Name, planetInput.Climate, planetInput.Terrain));

            _planetRepository.SaveChanges();

            newPlanet.ApparitionsInFilms = GetPlanetFromSwapi(newPlanet.Name);
            return(newPlanet);
        }
        public ActionResult <PlanetDto> Post([FromBody] PlanetInputDto planetInput)
        {
            Planet newPlanet = _planetService.Create(planetInput);

            return(CreatedAtAction(nameof(Get), new { id = newPlanet.Id }, new PlanetDto(newPlanet)));
        }