public async Task <bool> DeleteSolicitacao(int SolicitacaoId) { try { var solicitacao = await _SolicitacaoPresist.GetAllSolicitacaoByIdAsync(SolicitacaoId); if (solicitacao == null) { throw new Exception("Solicitacao para delete não encontrado."); } FGeralPersist.Delete <Solicitacao>(solicitacao); return(await FGeralPersist.SaveChangesAsync()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <bool> DeleteEvento(int eventoId) { var evento = await _eventoPersist.GetEventoByIdAsync(eventoId, false); if (evento == null) { throw new Exception("Evento para delete não foi encontrado"); } _geralpersist.Delete <Evento>(evento); return(await _geralpersist.SaveChangesAsync()); }
public async Task <bool> Delete(int id) { try{ _geralPersist.Delete(id); if (await _geralPersist.SaveChangesAsync()) { return(true); } return(false); }catch (Exception e) { throw new Exception(e.Message); } }
public async Task <bool> DeleteEvento(int eventoId) { try { var evento = await _eventoPersist.GetEventoByIdAsync(eventoId, false); if (evento == null) { throw new Exception("Evento de delete não encontrado."); } _geralPersist.Delete <Evento>(evento); return(await _geralPersist.SaveChangesAsync()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <bool> DeleteUser(int userId) { try { var usuario = await _userPresist.GetAllUserByIdAsync(userId); if (usuario == null) { throw new Exception("Usuario para delete não encontrado."); } FGeralPersist.Delete <user>(usuario); return(await FGeralPersist.SaveChangesAsync()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <bool> DeleteLote(int eventoId, int loteId) { try { var lote = await _lotePersist.GetLoteByIdsAsync(eventoId, loteId); if (lote == null) { throw new Exception("Lote para delete não encontrado"); } _geralPersist.Delete <Lote>(lote); return(await _geralPersist.SaveChangesAsync()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <bool> DeletePedido(int PedidoId) { try { var pedido = await _pedidoPresist.GetPedidoByIdAsync(PedidoId); if (pedido == null) { throw new Exception("Pedido para delete não encontrado."); } FGeralPersist.Delete <Pedido>(pedido); return(await FGeralPersist.SaveChangesAsync()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <bool> DeleteFornecedor(int FornecedorId) { try { var fornecedor = await _FornecedorPresist.GetAllFornecedorByIdAsync(FornecedorId); if (fornecedor == null) { throw new Exception("Usuario para delete não encontrado."); } FGeralPersist.Delete <Fornecedor>(fornecedor); return(await FGeralPersist.SaveChangesAsync()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <bool> DeleteLoja(int lojaId) { try { var loja = await _lojaPersist.GetLojaByIdAsync(lojaId); if (loja == null) { throw new Exception("Loja para remover não foi encontrada."); } _geralPersist.Delete <Loja>(loja); return(await _geralPersist.SaveChangesAsync()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <bool> DeleteCotacao(int CotacaoId) { try { var cotacao = await _CotacaoPresist.GetCotacaoByIdAsync(CotacaoId); if (cotacao == null) { throw new Exception("Cotacao para delete não encontrado."); } if (cotacao.status != 1) { FGeralPersist.Delete <Cotacao>(cotacao); return(await FGeralPersist.SaveChangesAsync()); } return(false); } catch (Exception ex) { throw new Exception(ex.Message); } }