public void Remove(int id, int bussinessId) { try { Supplier supplier = FindById(id, bussinessId); _context.Remove(supplier.Address); _context.Remove(supplier); _context.RemoveRange(supplier.Contacts); _context.SaveChanges(); } catch (Exception e) { throw new Exception(e.Message); } }
public async Task RemoveAsync(int id, int businessId) { try { Client client = await FindByIdAsync(id, businessId); _context.Remove(client.Address); _context.Remove(client); _context.RemoveRange(client.Contacts); _context.SaveChanges(); } catch (Exception e) { throw new Exception(e.Message); } }