public void Remove(int id) { var seller = FindById(id); _context.Remove(seller); _context.SaveChanges(); }
public async Task DeleteAsync(int id) { var obj = _context.Seller.Find(id); _context.Remove(obj); await _context.SaveChangesAsync(); }
public void Remove(int id) { var obj = _context.Seller.Find(id); _context.Remove(obj); _context.SaveChanges(); }
public async Task RemoveAsync(int id) { try { _context.Remove(await FindByIdAsync(id)); await _context.SaveChangesAsync(); } catch (DbUpdateException e) { throw new IntegrityException(e.Message); } }
public async Task RemoveAsync(int id) { try { var obj = _context.Seller.Find(id); _context.Remove(obj); await _context.SaveChangesAsync(); } catch (DbUpdateException) { throw new IntegrityException("It's not possible to delete this user because he/she has salles"); } }
public async Task RemoveAsync(int id) { try { var obj = await _context.Sellers.FindAsync(id); _context.Remove(obj); await _context.SaveChangesAsync(); } catch (DbUpdateException e) { throw new IntegrityException(e.Message); } }
public async Task RemoveAsync(int id) { try { var obj = await _context.Seller.FindAsync(id); _context.Remove(obj); await _context.SaveChangesAsync(); } catch (DbUpdateException) { throw new IntegrityException("Can't delete seller because he/she has sales"); } }
public async Task RemoveAsync(int id) { try { var obj = await _context.Seller.FindAsync(id); _context.Remove(obj); await _context.SaveChangesAsync(); } catch (DbUpdateException e) { throw new IntegrityException("Nao pode deletar o vendedor porque ele tem vendas!"); } }
public async Task RemoveAsync(int Id) { try { var obj = await _context.Seller.FindAsync(Id); _context.Remove(obj); await _context.SaveChangesAsync(); } catch (DbUpdateException e) { //throw new IntegrityException(e.Message); throw new IntegrityException("Não posso deletar o vendedor porque existe vendas."); } }