public ActionResult <PlanetDto> Get(int id)
        {
            Planet planet = _planetService.GetById(id);

            if (planet == null)
            {
                return(NotFound());
            }
            return(Ok(planet));
        }
Пример #2
0
        public async Task <IActionResult> UpdatePlanet([FromRoute] int planetId, [FromBody] Planet planet)
        {
            var result = await _planetService.GetById(planetId);

            result.Status      = planet.Status;
            result.Description = planet.Description;
            _planetService.Update(result);
            return(Ok(result));
        }
 public PlanetViewModel GetById(int id)
 {
     return(Mapper.Map <Planet, PlanetViewModel>(_planetService.GetById(id)));
 }