예제 #1
0
 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);
     }
 }
예제 #2
0
        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);
            }
        }
예제 #3
0
 public void Delete <T>(T entity) where T : class
 {
     _context.Remove(entity);
 }