public IActionResult GetById(int id) { var item = _repositorio.Find(id); if (item == null) { return(NotFound()); } return(new ObjectResult(item)); }
public ActionResult Obter(int id) { var obj = _servicoRepository.Find(id); if (obj == null) { return(NotFound()); } return(Ok(obj)); }
public override void Delete(long id) { try { ServicoModel servico = _repo.Find(id); if (servico.IsNull()) { throw new ServicoInvalidoException($"Serviço {id} não encontrado."); } servico.Deletar(); _repo.Save(servico); } catch (DomainException dEx) { Logger.Log.Warn(dEx); throw; } catch (Exception ex) { Logger.Log.Error(ex); throw; } }