Exemplo n.º 1
0
        public async Task <IActionResult> GetPlantById(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = await _plantService.GetPlantById(id);

            if (result == null)
            {
                return(NotFound(new { Message = $"Plant with id {id} not found" }));
            }

            return(Ok(result));
        }
Exemplo n.º 2
0
        public IActionResult GetPlantById(int id)
        {
            var plant = _service.GetPlantById(id);

            return(Ok(plant));
        }