void IProdutoRepository.Remover(Guid id) { try { var produtoTemp = ctx.Produtos.Find(id); ctx.Remove(produtoTemp); ctx.SaveChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public void Remover(Guid id) { try { Pedido pedido = BuscarPorId(id); if (pedido == null) { throw new Exception("Não foi possível achar o Id"); } _ctx.Remove(pedido); _ctx.SaveChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public void Delete <T>(T entity) where T : class { _context.Remove(entity); }