public IActionResult Get(Guid id) { try { // Busca a dica por id Post post = _repo.BuscarPorId(id); // caso der erro, retorna esse status code if (post == null) { return(NotFound()); } //se achar retorna a dica referente ao id return(Ok(post)); } catch (Exception ex) { return(BadRequest(ex)); } }
public Post BuscarPorId(long id) { return(_postRepository.BuscarPorId(id)); }