public void Atualizar(Estoque e) { EstoqueRepositorio rep = new EstoqueRepositorio(); if (rep.FindById(e.IdEstoque) != null) { rep.Update(e); } else { throw new EstoqueNaoEncontradoException(); } }
public Estoque BuscasPorId(int idEstoque) { EstoqueRepositorio rep = new EstoqueRepositorio(); Estoque e = rep.FindById(idEstoque); if (e != null) { return(e); } else { throw new EstoqueNaoEncontradoException(); } }
public void Excluir(int idEstoque) { EstoqueRepositorio rep = new EstoqueRepositorio(); if (rep.FindById(idEstoque) != null) { if (!rep.HastProduto(idEstoque)) { rep.Delete(idEstoque); } else { throw new EstoqueTemUmProdutoException(); } } else { throw new EstoqueNaoEncontradoException(); } }
public Estoque ObterPorId(int id) { EstoqueRepositorio rep = new EstoqueRepositorio(); return(rep.FindById(id)); }