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)); }
public IActionResult GetPlantById(int id) { var plant = _service.GetPlantById(id); return(Ok(plant)); }