public void deleteEmployee(Employee em) { var c = dal.GetAllContract(); foreach (var item in c) { if (item.EmployeeId == em.Id) { throw new Exception("You can't delete the employee.\n Because there is a contract realted to it!!!"); } } try { dal.deleteEmployee(em); } catch (InvalidCastException e) { throw e; } }
public List <Contract> GetAllContract() { return(dal.GetAllContract()); }